Top Description Fields Constructors Methods
org.bouncycastle.asn1

public Class BEROctetString

extends ASN1OctetString
Class Inheritance
Imports
java.io.IOException

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.

Field Summary

Modifier and TypeField and Description
private static final int
private final ASN1OctetString[]
private final int
Inherited from org.bouncycastle.asn1.ASN1OctetString:
EMPTY_OCTETSstringTYPE

Constructor Summary

AccessConstructor and Description
public
BEROctetString(byte[]
the octets making up the octet string.
string
)

Create an OCTET-STRING object from a byte[]

public
BEROctetString(ASN1OctetString[]
an array of OCTET STRING to construct the BER OCTET STRING from.
elements
)

Multiple ASN1OctetString data blocks are input, the result is constructed form.

public
BEROctetString(byte[]
the octets making up the octet string.
string
,
int
the number of octets stored in each DER encoded component OCTET STRING.
segmentLimit
)

Create an OCTET-STRING object from a byte[]

public
BEROctetString(ASN1OctetString[]
an array of OCTET STRING to construct the BER OCTET STRING from.
elements
,
int
the number of octets stored in each DER encoded component OCTET STRING.
segmentLimit
)

Multiple ASN1OctetString data blocks are input, the result is constructed form.

private
BEROctetString(byte[] string, ASN1OctetString[] elements, int segmentLimit)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
encode(ASN1OutputStream out, boolean withTag)

Implements abstract org.bouncycastle.asn1.ASN1Primitive.encode.

pack-priv boolean
encodeConstructed()

Implements abstract org.bouncycastle.asn1.ASN1Primitive.encodeConstructed.

Return true if this objected is a CONSTRUCTED one, false otherwise.

pack-priv int
pack-priv static byte[]
flattenOctetStrings(ASN1OctetString[] octetStrings)

Convert a vector of octet strings into a single byte string

Inherited from org.bouncycastle.asn1.ASN1OctetString:
asn1EqualscreatePrimitivegetInstancegetInstancegetLoadedObjectgetOctetsgetOctetsLengthgetOctetStreamhashCodeparsertoDERObjecttoDLObjecttoString

Field Detail

DEFAULT_SEGMENT_LIMITback to summary
private static final int DEFAULT_SEGMENT_LIMIT
elementsback to summary
private final ASN1OctetString[] elements
segmentLimitback to summary
private final int segmentLimit

Constructor Detail

BEROctetStringback to summary
public BEROctetString(byte[] string)

Create an OCTET-STRING object from a byte[]

Parameters
string:byte[]

the octets making up the octet string.

BEROctetStringback to summary
public BEROctetString(ASN1OctetString[] elements)

Multiple ASN1OctetString data blocks are input, the result is constructed form.

Parameters
elements:ASN1OctetString[]

an array of OCTET STRING to construct the BER OCTET STRING from.

BEROctetStringback to summary
public BEROctetString(byte[] string, int segmentLimit)

Create an OCTET-STRING object from a byte[]

Parameters
string:byte[]

the octets making up the octet string.

segmentLimit:int

the number of octets stored in each DER encoded component OCTET STRING.

BEROctetStringback to summary
public BEROctetString(ASN1OctetString[] elements, int segmentLimit)

Multiple ASN1OctetString data blocks are input, the result is constructed form.

Parameters
elements:ASN1OctetString[]

an array of OCTET STRING to construct the BER OCTET STRING from.

segmentLimit:int

the number of octets stored in each DER encoded component OCTET STRING.

BEROctetStringback to summary
private BEROctetString(byte[] string, ASN1OctetString[] elements, int segmentLimit)

Method Detail

encodeback to summary
pack-priv void encode(ASN1OutputStream out, boolean withTag) throws IOException

Implements abstract org.bouncycastle.asn1.ASN1Primitive.encode.

encodeConstructedback to summary
pack-priv boolean encodeConstructed()

Implements abstract org.bouncycastle.asn1.ASN1Primitive.encodeConstructed.

Doc from org.bouncycastle.asn1.ASN1Primitive.encodeConstructed.

Return true if this objected is a CONSTRUCTED one, false otherwise.

Returns:boolean

true if CONSTRUCTED bit set on object's tag, false otherwise.

encodedLengthback to summary
pack-priv int encodedLength(boolean withTag) throws IOException

Implements abstract org.bouncycastle.asn1.ASN1Primitive.encodedLength.

flattenOctetStringsback to summary
pack-priv static byte[] flattenOctetStrings(ASN1OctetString[] octetStrings)

Convert a vector of octet strings into a single byte string