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.
-
X509CertRequest()
- The default constructor is used to create a new empty certificate request.
-
X509CertRequest(byte[])
- Create a certificate request form a PEM or DER byte array.
-
X509CertRequest(String)
- Create a certificate request form a file.
-
getFingerprint()
- Returns the fingerprint of this certificate request.
-
getPublicKey()
- Returns the public key of this certificate request.
-
getSaveFormat()
- Returns the file format (ASN1.DER, ASN1.PEM) of the certificate request.
-
getSignatureAlgorithmID()
- Returns the signature algorithm of this certificate request.
-
getSubject()
- Returns the subject of this certificate request.
-
getVersion()
- Returns the version number of this certificate request.
-
saveToFile(String)
- Saves the certificate request into a file.
-
setPublicKey(PublicKey)
- Sets the public key of this certificate request.
-
setSaveFormat(int)
- Sets the file format when saving the cert request.
-
setSubject(Name)
- Sets the subject of this certificate request.
-
setVersion(int)
- Sets the version of this certificate request.
-
sign(AlgorithmID, RSAPrivateKey)
- Signs the certificate request with the private key of the subject.
-
toByteArray()
- Returns the certificate request in a byte array in DER format.
-
toString()
-
-
toString(boolean)
- Returns a string that represents the contents of the certificate.
-
verify()
- Verifies the self signed certificate request.
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
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
X509CertRequest
public X509CertRequest()
- The default constructor is used to create a new empty certificate request.
The values can be set with the setValue() methods.
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
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
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
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
setSaveFormat
public void setSaveFormat(int format)
- Sets the file format when saving the cert request.
- Parameters:
- format - ASN1.PEM or ASN1.DER
setVersion
public void setVersion(int v)
- Sets the version of this certificate request.
- Parameters:
- version - of the certificate request
setSubject
public void setSubject(Name su)
- Sets the subject of this certificate request.
- Parameters:
- subject - the subject of the certtificate request
setPublicKey
public void setPublicKey(PublicKey pk)
- Sets the public key of this certificate request.
- Parameters:
- pk - the public key of the subject
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
getVersion
public int getVersion()
- Returns the version number of this certificate request.
- Returns:
- version number of the certificate
getSignatureAlgorithmID
public AlgorithmID getSignatureAlgorithmID()
- Returns the signature algorithm of this certificate request.
- Returns:
- the signature algorithm used to sign this certificate request
getSubject
public Name getSubject()
- Returns the subject of this certificate request.
- Returns:
- the subject of the certificate request
getPublicKey
public PublicKey getPublicKey()
- Returns the public key of this certificate request.
- Returns:
- the public key of the the certificate request
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
toString
public String toString()
- Overrides:
- toString in class Object
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