KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > oyster > der > DERInteger


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

7
8
9 package org.enhydra.oyster.der;
10
11 import java.math.BigInteger JavaDoc;
12 import org.enhydra.oyster.exception.SMIMEException;
13
14
15 /**
16  * DERInteger is primitive type of DER encoded object which represents integer
17  * value in ASN.1 notation.
18  */

19 public class DERInteger extends DERObject {
20
21 /**
22  * Construction with the given integer value. This constructor is limited with
23  * dimension of Java type - long (from -9223372036854775808 to 9223372036854775807)
24  * @param integer0 data (long type)
25  * @exception SMIMEException thrown in super class constructor or in super class
26  * addContent method.
27  */

28   public DERInteger (long integer0) throws SMIMEException
29   {
30     super(2); // CMS version is Tag Type Integer (2)
31
super.addContent(new BigInteger JavaDoc(new Long JavaDoc(integer0).toString()).toByteArray());
32   }
33
34 /**
35  * Construction with the given BigInteger type of data. This constructor is
36  * used for integer numbers greater that long Java type can provide
37  * @param integer0 data (BigInteger type)
38  * @exception SMIMEException thrown in super class constructor or in super class
39  * addContent method.
40  */

41   public DERInteger (BigInteger JavaDoc integer0) throws SMIMEException
42   {
43     super(2); // CMS version is Tag Type Integer (2)
44
super.addContent(integer0.toByteArray());
45   }
46
47 }
48
49
50
51
Popular Tags