Bouncy Castle Cryptography Library 1.64

org.bouncycastle.asn1
Class BEROctetString

java.lang.Object
  extended byorg.bouncycastle.asn1.ASN1Object
      extended byorg.bouncycastle.asn1.ASN1Primitive
          extended byorg.bouncycastle.asn1.ASN1OctetString
              extended byorg.bouncycastle.asn1.BEROctetString
All Implemented Interfaces:
ASN1Encodable, ASN1OctetStringParser, Encodable, InMemoryRepresentable
Direct Known Subclasses:
BERConstructedOctetString

public class BEROctetString
extends ASN1OctetString

ASN.1 OctetStrings, with indefinite length rules, and constructed form support.

The Basic Encoding Rules (BER) format allows encoding using so called "constructed form", which DER and CER formats forbid allowing only "primitive form".

This class always produces the constructed form with underlying segments in an indefinite length array. If the input wasn't the same, then this output is not faithful reproduction.

See ASN1OctetString for X.690 encoding rules of OCTET-STRING objects.


Constructor Summary
BEROctetString(ASN1OctetString[] octs)
          Multiple ASN1OctetString data blocks are input, the result is constructed form.
BEROctetString(ASN1OctetString[] octs, int chunkSize)
          Multiple ASN1OctetString data blocks are input, the result is constructed form.
BEROctetString(byte[] string)
          Create an OCTET-STRING object from a byte[]
BEROctetString(byte[] string, int chunkSize)
          Create an OCTET-STRING object from a byte[]
 
Method Summary
 void encode(ASN1OutputStream out)
          Deprecated.  
 java.util.Enumeration getObjects()
          Return the OCTET STRINGs that make up this string.
 byte[] getOctets()
          Return a concatenated byte array of all the octets making up the constructed OCTET STRING
 
Methods inherited from class org.bouncycastle.asn1.ASN1OctetString
getInstance, getInstance, getLoadedObject, getOctetStream, hashCode, parser, toString
 
Methods inherited from class org.bouncycastle.asn1.ASN1Primitive
encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1Primitive
 
Methods inherited from class org.bouncycastle.asn1.ASN1Object
getEncoded, getEncoded, hasEncodedTagValue, toASN1Object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.bouncycastle.asn1.ASN1Encodable
toASN1Primitive
 

Constructor Detail

BEROctetString

public BEROctetString(byte[] string)
Create an OCTET-STRING object from a byte[]

Parameters:
string - the octets making up the octet string.

BEROctetString

public BEROctetString(ASN1OctetString[] octs)
Multiple ASN1OctetString data blocks are input, the result is constructed form.

Parameters:
octs - an array of OCTET STRING to construct the BER OCTET STRING from.

BEROctetString

public BEROctetString(byte[] string,
                      int chunkSize)
Create an OCTET-STRING object from a byte[]

Parameters:
string - the octets making up the octet string.
chunkSize - the number of octets stored in each DER encoded component OCTET STRING.

BEROctetString

public BEROctetString(ASN1OctetString[] octs,
                      int chunkSize)
Multiple ASN1OctetString data blocks are input, the result is constructed form.

Parameters:
octs - an array of OCTET STRING to construct the BER OCTET STRING from.
chunkSize - the number of octets stored in each DER encoded component OCTET STRING.
Method Detail

getOctets

public byte[] getOctets()
Return a concatenated byte array of all the octets making up the constructed OCTET STRING

Overrides:
getOctets in class ASN1OctetString
Returns:
the full OCTET STRING.

getObjects

public java.util.Enumeration getObjects()
Return the OCTET STRINGs that make up this string.

Returns:
an Enumeration of the component OCTET STRINGs.

encode

public void encode(ASN1OutputStream out)
            throws java.io.IOException
Deprecated.  

Throws:
java.io.IOException

Bouncy Castle Cryptography Library 1.64