KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > oyster > cms > IssuerAndSerialNumber


1 /*
2  * Title: Oyster Project
3  * Description: S/MIME email sending capabilities
4  * @Author Vladimir Radisic
5  * @Version 2.1.5
6  */

7
8
9 package org.enhydra.oyster.cms;
10
11 import org.enhydra.oyster.exception.SMIMEException;
12 import org.enhydra.oyster.der.DERSequencePr;
13 import java.security.cert.X509Certificate JavaDoc;
14
15
16 /**
17  * IssuerAndSerialNumber class is DER encoded object represented in ASN.1
18  * notation according to RFC2630. It is used on places where's important
19  * to obtain information about particular certificate. It contains issuer's
20  * data (name, country etc.) and serial number of the certificate. This class
21  * is super class of classes RecipientIdentifier and SignerIdentifier.<BR>
22  * <BR>
23  * <DL>
24  * IssuerAndSerialNumber ::= SEQUENCE {<BR>
25  * <DD> issuerName Name,<BR>
26  * <DD> serialNumber CertificateSerialNumber }<BR>
27  * </DL>
28  * <BR>
29  * Name ::= CHOICE { <BR>
30  * <DD> RDNSequence }<BR>
31  * <BR>
32  * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName<BR>
33  * <BR>
34  * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue<BR>
35  * <BR>
36  * <DD>
37  * AttributeTypeAndValue ::= SEQUENCE { <BR>
38  * <DD> type AttributeType, <BR>
39  * <DD> value AttributeValue }<BR>
40  * </DL>
41  * <BR>
42  * AttributeType ::= OBJECT IDENTIFIER<BR>
43  * <BR>
44  * AttributeValue ::= ANY DEFINED BY AttributeType<BR>
45  * <BR>
46  * <DL>
47  * DirectoryString ::= CHOICE {<BR>
48  * <DD> teletexString TeletexString (SIZE (1..MAX)),<BR>
49  * <DD> printableString PrintableString (SIZE (1..MAX)),<BR>
50  * <DD> universalString UniversalString (SIZE (1..MAX)),<BR>
51  * <DD> utf8String UTF8String (SIZE (1.. MAX)),<BR>
52  * <DD> bmpString BMPString (SIZE (1..MAX)) }<BR>
53  * </DL>
54  * <BR>
55  * CertificateSerialNumber ::= INTEGER<BR>
56  */

57 public class IssuerAndSerialNumber extends DERSequencePr {
58
59 /**
60  * Construction with information got from specific X509Certificate or from .cer
61  * file information which is extracted into instance of X509Certificate class
62  * @param cert0 X509Certificate
63  * @exception SMIMEException thrown from super class constructor or addContent
64  * method.
65  */

66   public IssuerAndSerialNumber (X509Certificate JavaDoc cert0) throws SMIMEException
67   {
68     IssuerName isName = new IssuerName(cert0);
69     isName.addAllRelativeDN(); // All distinguish name from certificate is copyed in to issuer name
70
super.addContent(isName.getDEREncoded());
71     super.addContent(new CertificateSerialNumber(cert0.getSerialNumber()).getDEREncoded());
72   }
73 }
74
75
76
77
Popular Tags