g-Eclipse
Release 1.0.0

eu.geclipse.core.security
Class X509Util

java.lang.Object
  extended by eu.geclipse.core.security.X509Util

public class X509Util
extends java.lang.Object

Utility class for handling X509Certificates.


Constructor Summary
X509Util()
           
 
Method Summary
static java.lang.String formatEncodedData(byte[] data)
          Get a proper string representation of the specified encrypted data.
static java.lang.String formatSerialNumber(java.math.BigInteger serial)
          Get a proper string representation of a certificate's serial number.
static java.security.cert.X509Certificate loadCertificate(java.io.InputStream iStream)
          Load a certificate from the specified input stream.
static void saveCertificate(java.security.cert.X509Certificate c, java.io.OutputStream oStream)
          Save the specified certificate formatted as PEM to the specified output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X509Util

public X509Util()
Method Detail

formatSerialNumber

public static java.lang.String formatSerialNumber(java.math.BigInteger serial)
Get a proper string representation of a certificate's serial number.

Parameters:
serial - The certificate's serial number.
Returns:
A string representation of the serial number.

formatEncodedData

public static java.lang.String formatEncodedData(byte[] data)
Get a proper string representation of the specified encrypted data.

Parameters:
data - The encrypted data.
Returns:
A string representing the specified data.

loadCertificate

public static java.security.cert.X509Certificate loadCertificate(java.io.InputStream iStream)
                                                          throws ProblemException
Load a certificate from the specified input stream.

Parameters:
iStream - The input stream pointing to the certificates raw data.
Returns:
The certificate itself.
Throws:
ProblemException - If no certificate could be loaded from the specified input stream.

saveCertificate

public static void saveCertificate(java.security.cert.X509Certificate c,
                                   java.io.OutputStream oStream)
                            throws ProblemException
Save the specified certificate formatted as PEM to the specified output stream.

Parameters:
c - The certificate to be saved.
oStream - The output stream where the certificate data should be written.
Throws:
ProblemException - If An error occurs.

g-Eclipse
Release 1.0.0