public abstract class ASN1Set extends ASN1Primitive implements Iterable<ASN1Encodable>
SET
and SET OF
constructs.
Note: This does not know which syntax the set is! (The difference: ordering of SET elements or not ordering.)
DER form is always definite form length fields, while BER support uses indefinite form.
The CER form support does not exist.
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
8.12.1 The encoding of a set-of value shall be constructed.
8.12.2 The text of 8.10.2 applies: The contents octets shall consist of zero, one or more complete encodings of data values from the type listed in the ASN.1 definition.
8.12.3 The order of data values need not be preserved by the encoding and subsequent decoding.
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.
The encodings of the component values of a set-of value shall appear in ascending order, the encodings being compared as octet strings with the shorter components being padded at their trailing end with 0-octets.
NOTE — The padding octets are for comparison purposes only and do not appear in the encodings.
Modifier and Type | Field and Description |
---|---|
protected ASN1Encodable[] |
elements |
protected ASN1Encodable[] |
sortedElements |
Modifier | Constructor and Description |
---|---|
protected |
ASN1Set() |
protected |
ASN1Set(ASN1Encodable element)
Create a SET containing one object
|
protected |
ASN1Set(ASN1Encodable[] elements,
boolean doSort)
Create a SET containing an array of objects.
|
protected |
ASN1Set(ASN1EncodableVector elementVector,
boolean doSort)
Create a SET containing a vector of objects.
|
Modifier and Type | Method and Description |
---|---|
static ASN1Set |
getInstance(ASN1TaggedObject taggedObject,
boolean explicit)
Return an ASN1 set from a tagged object.
|
static ASN1Set |
getInstance(java.lang.Object obj)
return an ASN1Set from the given object.
|
ASN1Encodable |
getObjectAt(int index)
return the object at the set position indicated by index.
|
java.util.Enumeration |
getObjects() |
int |
hashCode() |
java.util.Iterator<ASN1Encodable> |
iterator()
Returns an iterator over a set of elements of type T.
|
ASN1SetParser |
parser() |
int |
size()
return the number of objects in this set.
|
ASN1Encodable[] |
toArray() |
java.lang.String |
toString() |
encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1Primitive
getEncoded, getEncoded, hasEncodedTagValue
protected final ASN1Encodable[] elements
protected ASN1Encodable[] sortedElements
protected ASN1Set()
protected ASN1Set(ASN1Encodable element)
element
- object to be added to the SET.protected ASN1Set(ASN1EncodableVector elementVector, boolean doSort)
elementVector
- a vector of objects to make up the SET.doSort
- true if should be sorted DER style, false otherwise.protected ASN1Set(ASN1Encodable[] elements, boolean doSort)
elements
- an array of objects to make up the SET.doSort
- true if should be sorted DER style, false otherwise.public static ASN1Set getInstance(java.lang.Object obj)
obj
- the object we want converted.java.lang.IllegalArgumentException
- if the object cannot be converted.public static ASN1Set getInstance(ASN1TaggedObject taggedObject, boolean explicit)
taggedObject
- the tagged object.explicit
- true if the object is meant to be explicitly tagged
false otherwise.java.lang.IllegalArgumentException
- if the tagged object cannot
be converted.public java.util.Enumeration getObjects()
public ASN1Encodable getObjectAt(int index)
index
- the set number (starting at zero) of the objectpublic int size()
public ASN1Encodable[] toArray()
public ASN1SetParser parser()
public int hashCode()
hashCode
in class ASN1Primitive
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Iterator<ASN1Encodable> iterator()
Iterable
iterator
in interface java.lang.Iterable<ASN1Encodable>