|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--codec.asn1.ASN1AbstractCollection
|
+--codec.asn1.ASN1Sequence
|
+--codec.pkcs10.CertificationRequest
PKCS#10 Certification Request. This Object can be used to build a PKCS#10 compliant certification request for a self-created public key pair. The public key and the name of the subject have to be put into this certification request that is to be sent to a certification authority for certificate generation.
PKCS#10 defines the following data structure for certificate requests:
CertificationRequest ::= SEQUENCE {
certificationRequestInfo CertificationRequestInfo,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING
}
CertificationRequestInfo ::= SEQUENCE {
version Integer,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
attributes [0] IMPLICIT Attributes
}
Attributes ::= SET OF Attribute -- see PKCS#9
To build a PKCS#10 certification request, you can use the constructor CertificationRequest(PublicKey,Name) with your public key and name. After
that, you have to call getTBS() to get the to-be-signed (tbs) data,
sign them outside and call setSignature(byte[], AlgorithmIdentifier)
to fill-in the signature data. After that, you can export the certification
request using getEncoded().
Creation date: (18.08.99 15:23:09)
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
CertificationRequest()
Structure-constructor that builds the ASN.1 data structure. |
|
CertificationRequest(byte[] enc)
Constructor upon an byte-array that holds the DER-encoded Certification Request. |
|
CertificationRequest(InputStream in)
Constructor upon an input stream. |
|
CertificationRequest(PublicKey pk,
Name sub)
The given public key and name objects are put into this certification request. |
|
CertificationRequest(PublicKey pk,
Name sub,
Collection attr)
Standard-constructor upon JAVA-Objects. |
|
| Method Summary | |
List |
getAttributes()
Returns an unmodifiable list view on the attributes. |
byte[] |
getEncoded()
Returns the DER-encoded PKCS#10 data structure. |
PublicKey |
getPublicKey()
Returns the public key inside this Certification Request. |
AlgorithmIdentifier |
getPublicKeyAlgorithm()
Returns the AlgorithmIdentifier describing the public key's algorithm. |
byte[] |
getSignature()
Returns the signature on this certification request that is done by appliying the corresponding private key. |
Name |
getSubjectDN()
Returns the subject's distinguished name. |
byte[] |
getTBS()
Returns the to-be-signed (TBS) data structure, meaning the data to be applied on the signature algorithm. |
void |
setAttributes(Collection attributes)
Sets the given attributes. |
void |
setSignature(byte[] sg,
AlgorithmIdentifier algID)
Sets the signature. |
void |
sign(Signature sig,
PublicKey signerPub)
This methods implements an easy way to sign your certificate request. |
String |
toString()
Human-readable string representation of this Certification Request. |
void |
verify()
With this method, the certification request can be verified in an easy, but less secure way. |
void |
verify(String pro)
With this method, the certification request can be verified in an easy, but less secure way. |
| Methods inherited from class codec.asn1.ASN1Sequence |
getTag |
| Methods inherited from class codec.asn1.ASN1AbstractCollection |
checkConstraints, decode, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
| Constructor Detail |
public CertificationRequest()
public CertificationRequest(byte[] enc)
throws ASN1Exception
public CertificationRequest(InputStream in)
throws ASN1Exception,
IOException
in - InputStream that delivers the DER-encoded PKCS#10
Certification Request
Creation date: (20.08.99 21:42:03)
public CertificationRequest(PublicKey pk,
Name sub)
throws InvalidKeyException
getTBS() to get the
to-be-signed (tbs) data, sign them outside and call setSignature(byte[], AlgorithmIdentifier) to fill-in the signature
data. After that, you can export the certification request using
getEncoded().pk - the public key that is to be put inside this certification
requestsub - the Subject's name
Creation date: (20.08.99 21:42:03)
public CertificationRequest(PublicKey pk,
Name sub,
Collection attr)
throws InvalidKeyException
getTBS() to get the to-be-signed (tbs) data, sign them
outside and call setSignature(byte[], AlgorithmIdentifier) to *
fill-in the signature data. After that, you can export the certification
request using getEncoded().pk - the public key that is to be put inside this certification
requestsub - the Subject's nameattr - the Subject's attributes
Creation date: (20.05.00 18:46:46)| Method Detail |
public List getAttributes()
public byte[] getEncoded()
throws ASN1Exception
ASN1Exception - if an encoding problem occurs
public PublicKey getPublicKey()
throws NoSuchAlgorithmException
public AlgorithmIdentifier getPublicKeyAlgorithm()
public byte[] getSignature()
public Name getSubjectDN()
public byte[] getTBS()
throws CorruptedCodeException
public void setAttributes(Collection attributes)
attributes - The attributes.
Creation date: (20.05.00 18:46:46)
public void setSignature(byte[] sg,
AlgorithmIdentifier algID)
getTBS(). Note
that the AlgorithmIdentifier algID is not copied, meaning
that after calling this method, it must not be changed. Otherwise the
validity of the signature is lost and the object contents are corrupted!sg - the new signaturealgID - the algorithm identifier that describes the signature
algorithm Creation date: (20.08.99 21:42:03)public String toString()
toString in class ASN1AbstractCollection
public void verify()
throws NoSuchAlgorithmException,
InvalidKeyException,
NoSuchProviderException,
SignatureException
getTBS(), getPublicKey() and getSignature()
should be used along with an external verification. Verification is
successful if the signature can be verified using the public key inside
this object. Successful verification is done if no exception is thrown
from this method.
public void verify(String pro)
throws NoSuchAlgorithmException,
InvalidKeyException,
NoSuchProviderException,
SignatureException
getTBS(), getPublicKey() and getSignature()
should be used along with an external verification. Verification is
successful if the signature can be verified using the public key inside
this object. Successful verification is done if no exception is thrown
from this method.pro - Provider to be used for signature mechanism
public void sign(Signature sig,
PublicKey signerPub)
throws SignatureException,
CertificateEncodingException,
NoSuchAlgorithmException,
InvalidAlgorithmParameterException
sig - a Signature engine that is initialized for signing with
the appropriate private keysignerPub - the signer's public key (it is required to extract
algorithm parameters)SignatureException - if the signature could not be doneCertificateEncodingException - if an error occured during tbsCertificate encodingNoSuchAlgorithmException - if the Public key or is not available signature algorithmInvalidAlgorithmParameterException - if signature algorithm parameters could not be encoded
correctly
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||