At this time, this class supports only a subset of the types of DER data encodings which are defined. That subset is sufficient for generating most X.509 certificates.
Modifier and Type | Field and Description |
---|---|
private static final ByteArrayLexOrder | lexOrder
Lexicographical order comparison on byte arrays, for ordering elements of a SET OF objects in DER encoding. |
private static final ByteArrayTagOrder | tagOrder
Tag order comparison on byte arrays, for ordering elements of SET objects in DER encoding. |
private static final Date | utcHigh
12/31/2049 is the highest date that RFC 2630 serializes to UTC time |
private static final Date | utcLow
1/1/1950 is the lowest date that RFC 2630 serializes to UTC time |
Access | Constructor and Description |
---|---|
public | |
public |
Modifier and Type | Method and Description |
---|---|
pack-priv byte[] | |
public void | encode(DerOutputStream
the stream on which the DER encoding is written. out)Implements sun. Write the current contents of this |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | putInteger(BigInteger
the integer in the form of a BigInteger. i)Marshals a DER integer on the output stream. |
public DerOutputStream | putInteger(byte[]
the integer in bytes, equivalent to BigInteger::toByteArray. buf)Marshals a DER integer on the output stream. |
public DerOutputStream | putInteger(Integer
the integer in the form of an Integer. i)Marshals a DER integer on the output stream. |
public DerOutputStream | |
private void | |
public void | |
public DerOutputStream | |
public DerOutputStream | putOctetString(byte[]
the octet string octets)DER-encodes an ASN.1 OCTET STRING value on the output stream. |
public DerOutputStream | |
public DerOutputStream | |
private DerOutputStream | putOrderedSet(byte tag, DerEncoder[] set, Comparator<byte[]>
the order to use when sorting encodings of components. order)Marshals the contents of a set on the output stream with the encoding of elements sorted in increasing order. |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | |
private DerOutputStream | |
public DerOutputStream | putTruncatedUnalignedBitString(BitArray
the bit string, MSB first ba)Marshals a truncated DER bit string on the output stream. |
public DerOutputStream | putUnalignedBitString(BitArray
the bit string, MSB first ba)Marshals a DER bit string on the output stream. |
public DerOutputStream | |
public DerOutputStream | |
public DerOutputStream | write(byte
the DER value tag for the data, such as
DerValue.tag_Sequence tag, byte[] buffered data, which must be DER-encoded buf)Writes tagged, pre-marshaled data. |
public DerOutputStream | write(byte
the DER value tag for the data, such as
DerValue.tag_Sequence tag, DerOutputStream buffered data out)Writes tagged data using buffer-to-buffer copy. |
public DerOutputStream | |
public DerOutputStream | writeImplicit(byte
the DER value of the context-specific tag that replaces
original tag of the value in the output, such as in
tag, DerOutputStream
For example, FooLength [1] IMPLICIT INTEGER, with value=4;
would be encoded as "81 01 04" whereas in explicit
tagging it would be encoded as "A1 03 02 01 04".
Notice that the tag is A1 and not 81, this is because with
explicit tagging the form is always constructed.original value being implicitly tagged value)Writes implicitly tagged data using buffer-to-buffer copy. |
private DerOutputStream | writeString(String
the string to write s, byte one of the DER string tags that indicate which
encoding should be used to write the string out. stringTag, Charset the charset that should be used corresponding to
the above tag. charset)Private helper routine for writing DER encoded string values. |
lexOrder | back to summary |
---|---|
private static final ByteArrayLexOrder lexOrder Lexicographical order comparison on byte arrays, for ordering elements of a SET OF objects in DER encoding. |
tagOrder | back to summary |
---|---|
private static final ByteArrayTagOrder tagOrder Tag order comparison on byte arrays, for ordering elements of SET objects in DER encoding. |
utcHigh | back to summary |
---|---|
private static final Date utcHigh 12/31/2049 is the highest date that RFC 2630 serializes to UTC time |
utcLow | back to summary |
---|---|
private static final Date utcLow 1/1/1950 is the lowest date that RFC 2630 serializes to UTC time |
DerOutputStream | back to summary |
---|---|
public DerOutputStream(int size) Construct a DER output stream.
|
DerOutputStream | back to summary |
---|---|
public DerOutputStream() Construct a DER output stream. |
buf | back to summary |
---|---|
pack-priv byte[] buf() |
encode | back to summary |
---|---|
public void encode(DerOutputStream out) Implements sun. Write the current contents of this
|
putBitString | back to summary |
---|---|
public DerOutputStream putBitString(byte[] bits) Marshals a DER bit string on the output stream. The bit string must be byte-aligned.
|
putBMPString | back to summary |
---|---|
public DerOutputStream putBMPString(String s) Marshals a string as a DER encoded BMPString. |
putBoolean | back to summary |
---|---|
public DerOutputStream putBoolean(boolean val) Marshals a DER boolean on the output stream. |
putDerValue | back to summary |
---|---|
public DerOutputStream putDerValue(DerValue val) Marshals pre-encoded DER value onto the output stream. |
putEnumerated | back to summary |
---|---|
public DerOutputStream putEnumerated(int i) Marshals a DER enumerated on the output stream.
|
putGeneralizedTime | back to summary |
---|---|
public DerOutputStream putGeneralizedTime(Date d) Marshals a DER Generalized Time/date value. YYYYMMDDhhmmss{Z|+hhmm|-hhmm} ... emits only using Zulu time and with seconds (even if seconds=0) as per RFC 5280. |
putGeneralString | back to summary |
---|---|
public DerOutputStream putGeneralString(String s) Marshals a string as a DER encoded GeneralString. |
putIA5String | back to summary |
---|---|
public DerOutputStream putIA5String(String s) Marshals a string as a DER encoded IA5String. |
putInteger | back to summary |
---|---|
public DerOutputStream putInteger(BigInteger i) Marshals a DER integer on the output stream.
|
putInteger | back to summary |
---|---|
public DerOutputStream putInteger(byte[] buf) Marshals a DER integer on the output stream.
|
putInteger | back to summary |
---|---|
public DerOutputStream putInteger(Integer i) Marshals a DER integer on the output stream.
|
putInteger | back to summary |
---|---|
public DerOutputStream putInteger(int i) Marshals a DER integer on the output stream.
|
putIntegerContents | back to summary |
---|---|
private void putIntegerContents(int i) |
putLength | back to summary |
---|---|
public void putLength(int len) Put the encoding of the length in the stream.
|
putNull | back to summary |
---|---|
public DerOutputStream putNull() Marshals a DER "null" value on the output stream. These are often used to indicate optional values which have been omitted. |
putOctetString | back to summary |
---|---|
public DerOutputStream putOctetString(byte[] octets) DER-encodes an ASN.1 OCTET STRING value on the output stream.
|
putOID | back to summary |
---|---|
public DerOutputStream putOID(ObjectIdentifier oid) Marshals an object identifier (OID) on the output stream. Corresponds to the ASN.1 "OBJECT IDENTIFIER" construct. |
putOrderedSet | back to summary |
---|---|
public DerOutputStream putOrderedSet(byte tag, DerEncoder[] set) Marshals the contents of a set on the output stream. Sets are semantically unordered, but DER requires that encodings of set elements be sorted into ascending tag order before being output. Hence, sets with the same tags and elements have the same DER encoding. This method supports the ASN.1 "SET" construct, but not "SET OF", which uses a different order. |
putOrderedSet | back to summary |
---|---|
private DerOutputStream putOrderedSet(byte tag, DerEncoder[] set, Comparator<byte[]> order) Marshals the contents of a set on the output stream with the encoding of elements sorted in increasing order.
|
putOrderedSetOf | back to summary |
---|---|
public DerOutputStream putOrderedSetOf(byte tag, DerEncoder[] set) Marshals the contents of a set on the output stream. Sets are semantically unordered, but DER requires that encodings of set elements be sorted into ascending lexicographical order before being output. Hence, sets with the same tags and elements have the same DER encoding. This method supports the ASN.1 "SET OF" construct, but not "SET", which uses a different order. |
putPrintableString | back to summary |
---|---|
public DerOutputStream putPrintableString(String s) Marshals a string as a DER encoded PrintableString. |
putSequence | back to summary |
---|---|
public DerOutputStream putSequence(DerValue[] seq) Marshals a sequence on the output stream. This supports both the ASN.1 "SEQUENCE" (zero to N values) and "SEQUENCE OF" (one to N values) constructs. |
putSet | back to summary |
---|---|
public DerOutputStream putSet(DerValue[] set) Marshals the contents of a set on the output stream without ordering the elements. Ok for BER encoding, but not for DER encoding. For DER encoding, use orderedPutSet() or orderedPutSetOf(). |
putT61String | back to summary |
---|---|
public DerOutputStream putT61String(String s) Marshals a string as a DER encoded T61String. |
putTime | back to summary |
---|---|
public DerOutputStream putTime(Date d) Takes a Date and chooses UTC or GeneralizedTime as per RFC 2630 |
putTime | back to summary |
---|---|
private DerOutputStream putTime(Date d, byte tag) Private helper routine for marshalling a DER UTC/Generalized time/date value. If the tag specified is not that for UTC Time then it defaults to Generalized Time.
|
putTruncatedUnalignedBitString | back to summary |
---|---|
public DerOutputStream putTruncatedUnalignedBitString(BitArray ba) Marshals a truncated DER bit string on the output stream. The bit strings need not be byte-aligned.
|
putUnalignedBitString | back to summary |
---|---|
public DerOutputStream putUnalignedBitString(BitArray ba) Marshals a DER bit string on the output stream. The bit strings need not be byte-aligned.
|
putUTCTime | back to summary |
---|---|
public DerOutputStream putUTCTime(Date d) Marshals a DER UTC time/date value. YYMMDDhhmmss{Z|+hhmm|-hhmm} ... emits only using Zulu time and with seconds (even if seconds=0) as per RFC 5280. |
putUTF8String | back to summary |
---|---|
public DerOutputStream putUTF8String(String s) Marshals a string as a DER encoded UTF8String. |
write | back to summary |
---|---|
public DerOutputStream write(byte tag, byte[] buf) Writes tagged, pre-marshaled data. This calculates and encodes the length, so that the output data is the standard triple of { tag, length, data } used by all DER values.
|
write | back to summary |
---|---|
public DerOutputStream write(byte tag, DerOutputStream out) Writes tagged data using buffer-to-buffer copy. As above, this writes a standard DER record. This is often used when efficiently encapsulating values in sequences.
|
write | back to summary |
---|---|
public DerOutputStream write(DerEncoder encoder) Write a DerEncoder onto the output stream.
|
writeImplicit | back to summary |
---|---|
public DerOutputStream writeImplicit(byte tag, DerOutputStream value) Writes implicitly tagged data using buffer-to-buffer copy. As above, this writes a standard DER record. This is often used when efficiently encapsulating implicitly tagged values.
|
writeString | back to summary |
---|---|
private DerOutputStream writeString(String s, byte stringTag, Charset charset) Private helper routine for writing DER encoded string values. |