1 package org.bouncycastle.asn1; 2 3 import java.io.IOException; 4 5 public class DEROctetString 6 extends ASN1OctetString 7 { 8 /** 9 * @param string the octets making up the octet string. 10 */ DEROctetString( byte[] string)11 public DEROctetString( 12 byte[] string) 13 { 14 super(string); 15 } 16 DEROctetString( ASN1Encodable obj)17 public DEROctetString( 18 ASN1Encodable obj) 19 throws IOException 20 { 21 super(obj.toASN1Primitive().getEncoded(ASN1Encoding.DER)); 22 } 23 isConstructed()24 boolean isConstructed() 25 { 26 return false; 27 } 28 encodedLength()29 int encodedLength() 30 { 31 return 1 + StreamUtil.calculateBodyLength(string.length) + string.length; 32 } 33 encode( ASN1OutputStream out)34 void encode( 35 ASN1OutputStream out) 36 throws IOException 37 { 38 out.writeEncoded(BERTags.OCTET_STRING, string); 39 } 40 encode( DEROutputStream derOut, byte[] bytes)41 static void encode( 42 DEROutputStream derOut, 43 byte[] bytes) 44 throws IOException 45 { 46 derOut.writeEncoded(BERTags.OCTET_STRING, bytes); 47 } 48 } 49