01: package org.bouncycastle.asn1.ess;
02:
03: import org.bouncycastle.asn1.ASN1Encodable;
04: import org.bouncycastle.asn1.ASN1OctetString;
05: import org.bouncycastle.asn1.DERObject;
06: import org.bouncycastle.asn1.DEROctetString;
07:
08: public class ContentIdentifier extends ASN1Encodable {
09: ASN1OctetString value;
10:
11: public static ContentIdentifier getInstance(Object o) {
12: if (o == null || o instanceof ContentIdentifier) {
13: return (ContentIdentifier) o;
14: } else if (o instanceof ASN1OctetString) {
15: return new ContentIdentifier((ASN1OctetString) o);
16: }
17:
18: throw new IllegalArgumentException(
19: "unknown object in 'ContentIdentifier' factory : "
20: + o.getClass().getName() + ".");
21: }
22:
23: /**
24: * Create from OCTET STRING whose octets represent the identifier.
25: */
26: public ContentIdentifier(ASN1OctetString value) {
27: this .value = value;
28: }
29:
30: /**
31: * Create from byte array representing the identifier.
32: */
33: public ContentIdentifier(byte[] value) {
34: this (new DEROctetString(value));
35: }
36:
37: public ASN1OctetString getValue() {
38: return value;
39: }
40:
41: /**
42: * The definition of ContentIdentifier is
43: * <pre>
44: * ContentIdentifier ::= OCTET STRING
45: * </pre>
46: * id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1)
47: * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
48: * smime(16) id-aa(2) 7 }
49: */
50: public DERObject toASN1Object() {
51: return value;
52: }
53: }
|