All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.x509.X509CertRequest

java.lang.Object
   |
   +----iaik.x509.X509Extensions
           |
           +----iaik.x509.X509CertRequest

public class X509CertRequest
extends X509Extensions
This class represents a X509 certificate request.


Constructor Index

 o X509CertRequest()
The default constructor is used to create a new empty certificate request.
 o X509CertRequest(byte[])
Create a certificate request form a PEM or DER byte array.
 o X509CertRequest(String)
Create a certificate request form a file.

Method Index

 o getFingerprint()
Returns the fingerprint of this certificate request.
 o getPublicKey()
Returns the public key of this certificate request.
 o getSaveFormat()
Returns the file format (ASN1.DER, ASN1.PEM) of the certificate request.
 o getSignatureAlgorithmID()
Returns the signature algorithm of this certificate request.
 o getSubject()
Returns the subject of this certificate request.
 o getVersion()
Returns the version number of this certificate request.
 o saveToFile(String)
Saves the certificate request into a file.
 o setPublicKey(PublicKey)
Sets the public key of this certificate request.
 o setSaveFormat(int)
Sets the file format when saving the cert request.
 o setSubject(Name)
Sets the subject of this certificate request.
 o setVersion(int)
Sets the version of this certificate request.
 o sign(AlgorithmID, RSAPrivateKey)
Signs the certificate request with the private key of the subject.
 o toByteArray()
Returns the certificate request in a byte array in DER format.
 o toString()
 o toString(boolean)
Returns a string that represents the contents of the certificate.
 o verify()
Verifies the self signed certificate request.

Constructors

 o X509CertRequest
 public X509CertRequest(String fileName) throws IOException, CodingException
Create a certificate request form a file. The data can be in PEM or DER format.

Parameters:
fileName - the name of the file containing the certificate
Throws: IOException
if the certificate could not be read
Throws: CodingException
if there is a problem with the certificate request
 o X509CertRequest
 public X509CertRequest(byte arr[]) throws CodingException
Create a certificate request form a PEM or DER byte array.

Parameters:
array - the byte array containing the certificate request
Throws: CodingException
if the format of the cert request is wrong
 o X509CertRequest
 public X509CertRequest()
The default constructor is used to create a new empty certificate request. The values can be set with the setValue() methods.

Methods

 o sign
 public void sign(AlgorithmID signatureAlg,
                  RSAPrivateKey issuerSK) throws SignatureException, InvalidKeyException, NoSuchAlgorithmException
Signs the certificate request with the private key of the subject. A PKCS#1 standard signature is created.

Parameters:
signatureAlg - the AlgorithmID of the signature algorithm
issuerPK - the private key of the subject
Throws: SignatureException
if the certificate could not be created
Throws: InvalidKeyException
if the format of the key is wrong
Throws: NoSuchAlgorithmException
if there is no implementation for the specified signature algorithm
 o verify
 public boolean verify() throws SignatureException
Verifies the self signed certificate request.

Returns:
true if the cert request is OK
Throws: SignatureException
if the certificate request could not be verified
 o toByteArray
 public byte[] toByteArray()
Returns the certificate request in a byte array in DER format. The DER format (Distinguished Encoding Rules) defines a binary representation of an abstract ASN.1 datastructure.

Returns:
the certificate request in DER format
 o saveToFile
 public void saveToFile(String fileName) throws IOException
Saves the certificate request into a file.

Parameters:
fileName - the name of the file
Throws: IOException
if an error occurs during saving the file
 o setSaveFormat
 public void setSaveFormat(int format)
Sets the file format when saving the cert request.

Parameters:
format - ASN1.PEM or ASN1.DER
 o setVersion
 public void setVersion(int v)
Sets the version of this certificate request.

Parameters:
version - of the certificate request
 o setSubject
 public void setSubject(Name su)
Sets the subject of this certificate request.

Parameters:
subject - the subject of the certtificate request
 o setPublicKey
 public void setPublicKey(PublicKey pk)
Sets the public key of this certificate request.

Parameters:
pk - the public key of the subject
 o getSaveFormat
 public int getSaveFormat()
Returns the file format (ASN1.DER, ASN1.PEM) of the certificate request. Shows the format of the file from which the certificate request was read.

Returns:
the safe format
 o getVersion
 public int getVersion()
Returns the version number of this certificate request.

Returns:
version number of the certificate
 o getSignatureAlgorithmID
 public AlgorithmID getSignatureAlgorithmID()
Returns the signature algorithm of this certificate request.

Returns:
the signature algorithm used to sign this certificate request
 o getSubject
 public Name getSubject()
Returns the subject of this certificate request.

Returns:
the subject of the certificate request
 o getPublicKey
 public PublicKey getPublicKey()
Returns the public key of this certificate request.

Returns:
the public key of the the certificate request
 o getFingerprint
 public byte[] getFingerprint()
Returns the fingerprint of this certificate request. This is a MD5 hash of the DER encoded certificate request.

Returns:
the fingerprint of the certificate request
 o toString
 public String toString()
Overrides:
toString in class Object
 o toString
 public String toString(boolean detailed)
Returns a string that represents the contents of the certificate.

Parameters:
detailed - - whether or not to give detailed information about the certificate.
Returns:
the string representation

All Packages  Class Hierarchy  This Package  Previous  Next  Index