public abstract class ASN1Set extends ASN1Primitive
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.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 |
---|---|
private boolean |
isSorted |
private Vector |
set |
Modifier | Constructor and Description |
---|---|
protected |
ASN1Set() |
protected |
ASN1Set(ASN1Encodable obj)
create a sequence containing one object
|
protected |
ASN1Set(ASN1Encodable[] array,
boolean doSort)
create a sequence containing a vector of objects.
|
protected |
ASN1Set(ASN1EncodableVector v,
boolean doSort)
create a sequence containing a vector of objects.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
asn1Equals(ASN1Primitive o) |
(package private) abstract void |
encode(ASN1OutputStream out) |
private byte[] |
getDEREncoded(ASN1Encodable obj) |
static ASN1Set |
getInstance(ASN1TaggedObject obj,
boolean explicit)
Return an ASN1 set from a tagged object.
|
static ASN1Set |
getInstance(Object obj)
return an ASN1Set from the given object.
|
private ASN1Encodable |
getNext(Enumeration e) |
ASN1Encodable |
getObjectAt(int index)
return the object at the set position indicated by index.
|
Enumeration |
getObjects() |
int |
hashCode() |
(package private) boolean |
isConstructed() |
private boolean |
lessThanOrEqual(byte[] a,
byte[] b)
return true if a <= b (arrays are assumed padded with zeros).
|
ASN1SetParser |
parser() |
int |
size()
return the number of objects in this set.
|
protected void |
sort() |
ASN1Encodable[] |
toArray() |
(package private) ASN1Primitive |
toDERObject()
Change current SET object to be encoded as
DERSet . |
(package private) ASN1Primitive |
toDLObject()
Change current SET object to be encoded as
DLSet . |
String |
toString() |
encodedLength, equals, fromByteArray, toASN1Primitive
getEncoded, getEncoded, hasEncodedTagValue, toASN1Object
protected ASN1Set()
protected ASN1Set(ASN1Encodable obj)
obj
- object to be added to the SET.protected ASN1Set(ASN1EncodableVector v, boolean doSort)
v
- a vector of objects to make up the SET.doSort
- true if should be sorted DER style, false otherwise.protected ASN1Set(ASN1Encodable[] array, boolean doSort)
public static ASN1Set getInstance(Object obj)
obj
- the object we want converted.IllegalArgumentException
- if the object cannot be converted.public static ASN1Set getInstance(ASN1TaggedObject obj, boolean explicit)
obj
- the tagged object.explicit
- true if the object is meant to be explicitly tagged
false otherwise.IllegalArgumentException
- if the tagged object cannot
be converted.public 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
ASN1Primitive toDERObject()
DERSet
.
This is part of Distinguished Encoding Rules form serialization.toDERObject
in class ASN1Primitive
ASN1Primitive toDLObject()
DLSet
.
This is part of Direct Length form serialization.toDLObject
in class ASN1Primitive
boolean asn1Equals(ASN1Primitive o)
asn1Equals
in class ASN1Primitive
private ASN1Encodable getNext(Enumeration e)
private boolean lessThanOrEqual(byte[] a, byte[] b)
private byte[] getDEREncoded(ASN1Encodable obj)
protected void sort()
boolean isConstructed()
isConstructed
in class ASN1Primitive
abstract void encode(ASN1OutputStream out) throws IOException
encode
in class ASN1Primitive
IOException