001package org.apache.commons.ssl.org.bouncycastle.asn1.ess; 002 003import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Object; 004import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1OctetString; 005import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Primitive; 006import org.apache.commons.ssl.org.bouncycastle.asn1.DEROctetString; 007 008public class ContentIdentifier 009 extends ASN1Object 010{ 011 ASN1OctetString value; 012 013 public static ContentIdentifier getInstance(Object o) 014 { 015 if (o instanceof ContentIdentifier) 016 { 017 return (ContentIdentifier) o; 018 } 019 else if (o != null) 020 { 021 return new ContentIdentifier(ASN1OctetString.getInstance(o)); 022 } 023 024 return null; 025 } 026 027 /** 028 * Create from OCTET STRING whose octets represent the identifier. 029 */ 030 private ContentIdentifier( 031 ASN1OctetString value) 032 { 033 this.value = value; 034 } 035 036 /** 037 * Create from byte array representing the identifier. 038 */ 039 public ContentIdentifier( 040 byte[] value) 041 { 042 this(new DEROctetString(value)); 043 } 044 045 public ASN1OctetString getValue() 046 { 047 return value; 048 } 049 050 /** 051 * The definition of ContentIdentifier is 052 * <pre> 053 * ContentIdentifier ::= OCTET STRING 054 * </pre> 055 * id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1) 056 * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) 057 * smime(16) id-aa(2) 7 } 058 */ 059 public ASN1Primitive toASN1Primitive() 060 { 061 return value; 062 } 063}