public class NetscapeCertRequest extends java.lang.Object implements CertRequest
This class only can be used for parsing an already existing NetscapeCertRequest, supplied in DER or PEM encoded format. Therefore this class provides two constructors for creating a NetscapeCertRequest from an InputStream, or from byte array supplying the PEM or DER encoded request. The given data is decoded and "translated" into a "SignedPublicKeyAndChallange" ASN.1 data structure as defined by the Netscape Certificate Specifications:
SignedPublicKeyAndChallenge ::= SEQUENCE { publicKeyAndChallenge PublicKeyAndChallenge, signatureAlgorithm AlgorithmIdentifier, signature BIT STRING }
where:
PublicKeyAndChallenge ::= SEQUENCE { spki SubjectPublicKeyInfo, challenge IA5STRING }
For obtaining the public key from this "SignedPublicKeyAndChallange" structure, use
the getPublicKey
method. The self-signed
"SignedPublicKeyAndChallange" structure can be verified using the
verify
method.
Constructor and Description |
---|
NetscapeCertRequest(byte[] arr)
Creates a
NetscapeCertRequest from a byte array supplying the PEM or DER
encoded request. |
NetscapeCertRequest(java.io.InputStream is)
Creates a
NetscapeCertRequest from an InputStream supplying
the PEM or DER encoded request. |
Modifier and Type | Method and Description |
---|---|
java.security.PublicKey |
getPublicKey()
Returns the public key from this "SignedPublicKeyAndChallange" structure.
|
boolean |
verify()
Verifies the self signed certificate request.
|
public NetscapeCertRequest(java.io.InputStream is) throws java.io.IOException, CodingException
NetscapeCertRequest
from an InputStream supplying
the PEM or DER encoded request.
From the request derived from the given input stream the "SignedPublicKeyAndChallange" ASN.1 data structure is created.
is
- the input stream from where to read the PEM/DER encoded cert requestjava.io.IOException
- if an I/O error occurs.CodingException
- if the CertRequest could not be parsedpublic NetscapeCertRequest(byte[] arr) throws CodingException
NetscapeCertRequest
from a byte array supplying the PEM or DER
encoded request.
From the request derived from the given byte array the "SignedPublicKeyAndChallange" ASN.1 data structure is created.
arr
- the array containing the DER/PEM encoded CertRequestCodingException
- if the CertRequest could not be parsedpublic boolean verify() throws java.security.SignatureException
verify
in interface CertRequest
true
if the cert request is OK, false
if notjava.security.SignatureException
- if the cert request could not be verifiedpublic java.security.PublicKey getPublicKey() throws java.security.InvalidKeyException
getPublicKey
in interface CertRequest
java.security.InvalidKeyException
- if the public key from this "SignedPublicKeyAndChallange"
structure cannot not be created