01: /*
02: * Title: Oyster Project
03: * Description: S/MIME email transport capabilities.
04: * @Author Vladimir Radisic
05: * @Version 2.1.5
06: */
07:
08: package org.enhydra.oyster.der;
09:
10: import java.math.BigInteger;
11: import org.enhydra.oyster.exception.SMIMEException;
12:
13: /**
14: * DERInteger is primitive type of DER encoded object which represents integer
15: * value in ASN.1 notation.
16: */
17: public class DERInteger extends DERObject {
18:
19: /**
20: * Construction with the given integer value. This constructor is limited with
21: * dimension of Java type - long (from -9223372036854775808 to 9223372036854775807)
22: * @param integer0 data (long type)
23: * @exception SMIMEException thrown in super class constructor or in super class
24: * addContent method.
25: */
26: public DERInteger(long integer0) throws SMIMEException {
27: super (2); // CMS version is Tag Type Integer (2)
28: super .addContent(new BigInteger(new Long(integer0).toString())
29: .toByteArray());
30: }
31:
32: /**
33: * Construction with the given BigInteger type of data. This constructor is
34: * used for integer numbers greater that long Java type can provide
35: * @param integer0 data (BigInteger type)
36: * @exception SMIMEException thrown in super class constructor or in super class
37: * addContent method.
38: */
39: public DERInteger(BigInteger integer0) throws SMIMEException {
40: super (2); // CMS version is Tag Type Integer (2)
41: super.addContent(integer0.toByteArray());
42: }
43:
44: }
|