Top Description Fields Constructors Methods
org.bouncycastle.asn1

public Class DLSet

extends ASN1Set
Class Inheritance
Imports
java.io.IOException

The DLSet encodes ASN.1 SET value without element ordering, and always using definite length form.

X.690

8: Basic encoding rules

8.11 Encoding of a set value

8.11.1 The encoding of a set value shall be constructed

8.11.2 The contents octets shall consist of the complete encoding of a data value from each of the types listed in the ASN.1 definition of the set type, in an order chosen by the sender, unless the type was referenced with the keyword OPTIONAL or the keyword DEFAULT.

8.11.3 The encoding of a data value may, but need not, be present for a type which was referenced with the keyword OPTIONAL or the keyword DEFAULT.

NOTE — The order of data values in a set value is not significant, and places no constraints on the order during transfer

9: Canonical encoding rules

9.3 Set components

The encodings of the component values of a set value shall appear in an order determined by their tags as specified in 8.6 of ITU-T Rec. X.680 | ISO/IEC 8824-1. Additionally, for the purposes of determining the order in which components are encoded when one or more component is an untagged choice type, each untagged choice type is ordered as though it has a tag equal to that of the smallest tag in that choice type or any untagged choice types nested within.

10: Distinguished encoding rules

10.3 Set components

The encodings of the component values of a set value shall appear in an order determined by their tags as specified in 8.6 of ITU-T Rec. X.680 | ISO/IEC 8824-1.
NOTE — Where a component of the set is an untagged choice type, the location of that component in the ordering will depend on the tag of the choice component being encoded.

11: Restrictions on BER employed by both CER and DER

11.5 Set and sequence components with default value

The encoding of a set value or sequence value shall not include an encoding for any component value which is equal to its default value.

Field Summary

Modifier and TypeField and Description
private int
Inherited from org.bouncycastle.asn1.ASN1Set:
elementssortedElementsTYPE

Constructor Summary

AccessConstructor and Description
public
DLSet()

create an empty set

public
DLSet(ASN1Encodable
- a single object that makes up the set.
element
)

public
DLSet(ASN1EncodableVector
- a vector of objects making up the set.
elementVector
)

public
DLSet(ASN1Encodable[] elements)

create a set from an array of objects.

pack-priv
DLSet(boolean isSorted, ASN1Encodable[] elements)

pack-priv
DLSet(ASN1Encodable[] elements, ASN1Encodable[] sortedElements)

Method Summary

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

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

A note on the implementation:

As DL requires the constructed, definite-length model to be used for structured types, this varies slightly from the ASN.1 descriptions given.

pack-priv int
private int
pack-priv ASN1Primitive
toDLObject()

Overrides org.bouncycastle.asn1.ASN1Set.toDLObject.

Change current SET object to be encoded as DLSet.
Inherited from org.bouncycastle.asn1.ASN1Set:
asn1EqualsencodeConstructedgetInstancegetInstancegetObjectAtgetObjectshashCodeiteratorparsersizetoArraytoDERObjecttoString

Field Detail

contentsLengthback to summary
private int contentsLength

Constructor Detail

DLSetback to summary
public DLSet()

create an empty set

DLSetback to summary
public DLSet(ASN1Encodable element)
Parameters
element:ASN1Encodable

- a single object that makes up the set.

DLSetback to summary
public DLSet(ASN1EncodableVector elementVector)
Parameters
elementVector:ASN1EncodableVector

- a vector of objects making up the set.

DLSetback to summary
public DLSet(ASN1Encodable[] elements)

create a set from an array of objects.

DLSetback to summary
pack-priv DLSet(boolean isSorted, ASN1Encodable[] elements)
DLSetback to summary
pack-priv DLSet(ASN1Encodable[] elements, ASN1Encodable[] sortedElements)

Method Detail

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

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

A note on the implementation:

As DL requires the constructed, definite-length model to be used for structured types, this varies slightly from the ASN.1 descriptions given. Rather than just outputting SET, we also have to specify CONSTRUCTED, and the objects length.

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

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

getContentsLengthback to summary
private int getContentsLength() throws IOException
toDLObjectback to summary
pack-priv ASN1Primitive toDLObject()

Overrides org.bouncycastle.asn1.ASN1Set.toDLObject.

Doc from org.bouncycastle.asn1.ASN1Set.toDLObject.

Change current SET object to be encoded as DLSet. This is part of Direct Length form serialization.

Returns:ASN1Primitive

Doc from org.bouncycastle.asn1.ASN1Primitive.toDLObject.

a DL version of this.