com.dstc.security.pki
Class PKCS10CertificationRequest

java.lang.Object
  |
  +--com.dstc.security.pki.PKCS10CertificationRequest

public class PKCS10CertificationRequest
extends Object
implements CertificationRequest

Implementation of CertficateRequest for PKCS10

Implements the ASN.1 structure CertificationRequest.

 CertificationRequest ::= SEQUENCE {
   certificationRequestInfo CertificationRequestInfo,
   signatureAlgorithm SignatureAlgorithmIdentifier,
   signature Signature }
 
 CertificationRequestInfo ::= SEQUENCE {
   version Version,
   subject Name,
   subjectPublicKeyInfo SubjectPublicKeyInfo,
   attributes [0] IMPLICIT Attributes }

 Version ::= INTEGER

 Attributes ::= SET OF Attribute
 SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
 
 Signature ::= BIT STRING
 


Constructor Summary
PKCS10CertificationRequest(byte[] encoded)
          Constructs a PKCS10CertificationRequest object from a byte array containing an encoding of a pkcs10 request.
PKCS10CertificationRequest(InputStream is)
          Constructs a PKCS10CertificationRequest object from an InputStream containing an encoding of a pkcs10 request.
PKCS10CertificationRequest(String dn, PublicKey pub, Set atts, String sigAlgName, PrivateKey priv)
           Constructs PKCS10CertificationRequest from the subject's DN, a set of Attributes, the signature algorithm name and subject's private key.
 
Method Summary
 byte[] getEncoded()
          Returns the DER encoding for this PKCS10CertificationRequest
 byte[] getEncodedPublicKey()
          Returns the encoding of SubjectPublicKeyInfo defined by the ASN.1 structure
 String getKeyAlgName()
          Returns the key algorithm name for this PKCS10CertificationRequest
 PublicKey getPublicKey()
          Returns the PublicKey for this PKCS10CertificationRequest
 String getSigAlgName()
          Returns the signature algorithm name for this PKCS10CertificationRequest
 byte[] getSignature()
          Returns the signature for this PKCS10CertificationRequest
 String getSubjectName()
          Returns the subject name for this PKCS10CertificationRequest
 boolean verifySignature()
          Verifies the signature in this PKCS10CertificationRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS10CertificationRequest

public PKCS10CertificationRequest(String dn,
                                  PublicKey pub,
                                  Set atts,
                                  String sigAlgName,
                                  PrivateKey priv)
                           throws PKIException

Constructs PKCS10CertificationRequest from the subject's DN, a set of Attributes, the signature algorithm name and subject's private key.

Parameters:
dn - subject's Distinguished Name (DN)
pub - the subject's public key
atts - set of attributes for this request
sigAlgName - the algorithm name of the signature
priv - the subject's private key
Throws:
PKIException -  

PKCS10CertificationRequest

public PKCS10CertificationRequest(byte[] encoded)
                           throws PKIException
Constructs a PKCS10CertificationRequest object from a byte array containing an encoding of a pkcs10 request. The encoding can be in ASN.1 DER format, or be a PEM encoding thereof in which the header can either be "-----BEGIN NEW CERTIFICATE REQUEST-----" or "-----BEGIN CERTIFICATION REQUEST-----".
Parameters:
encoded - the byte array containing the DER encoding
Throws:
PKIException -  

PKCS10CertificationRequest

public PKCS10CertificationRequest(InputStream is)
                           throws PKIException
Constructs a PKCS10CertificationRequest object from an InputStream containing an encoding of a pkcs10 request. The encoding can be in ASN.1 DER format, or be a PEM encoding thereof in which the header can either be "-----BEGIN NEW CERTIFICATE REQUEST-----" or "-----BEGIN CERTIFICATION REQUEST-----".
Parameters:
is - the InputStream containing the DER encoding
Throws:
PKIException -  
Method Detail

getEncoded

public byte[] getEncoded()
Returns the DER encoding for this PKCS10CertificationRequest
Specified by:
getEncoded in interface CertificationRequest

getEncodedPublicKey

public byte[] getEncodedPublicKey()
Returns the encoding of SubjectPublicKeyInfo defined by the ASN.1 structure
    SubjectPublicKeyInfo  ::= SEQUENCE  {
       algorithm            AlgorithmIdentifier,
       subjectPublicKey     BIT STRING  }

 
Specified by:
getEncodedPublicKey in interface CertificationRequest

getPublicKey

public PublicKey getPublicKey()
Returns the PublicKey for this PKCS10CertificationRequest
Specified by:
getPublicKey in interface CertificationRequest

getSignature

public byte[] getSignature()
Returns the signature for this PKCS10CertificationRequest
Specified by:
getSignature in interface CertificationRequest

getSigAlgName

public String getSigAlgName()
Returns the signature algorithm name for this PKCS10CertificationRequest
Specified by:
getSigAlgName in interface CertificationRequest

getKeyAlgName

public String getKeyAlgName()
Returns the key algorithm name for this PKCS10CertificationRequest
Specified by:
getKeyAlgName in interface CertificationRequest

getSubjectName

public String getSubjectName()
Returns the subject name for this PKCS10CertificationRequest
Specified by:
getSubjectName in interface CertificationRequest

verifySignature

public boolean verifySignature()
Verifies the signature in this PKCS10CertificationRequest
Specified by:
verifySignature in interface CertificationRequest