| java.lang.Object java.io.OutputStream java.io.ByteArrayOutputStream sun.security.util.DerOutputStream
DerOutputStream | public class DerOutputStream extends ByteArrayOutputStream implements DerEncoder(Code) | | Output stream marshaling DER-encoded data. This is eventually provided
in the form of a byte array; there is no advance limit on the size of
that byte array.
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.
version: 1.39 author: David Brownell author: Amit Kapoor author: Hemma Prafullchandra |
Method Summary | |
public void | derEncode(OutputStream out) Write the current contents of this DerOutputStream
to an OutputStream . | public void | putBMPString(String s) Marshals a string as a DER encoded BMPString. | public void | putBitString(byte[] bits) Marshals a DER bit string on the output stream. | public void | putBoolean(boolean val) Marshals a DER boolean on the output stream. | public void | putDerValue(DerValue val) Marshals pre-encoded DER value onto the output stream. | public void | putEnumerated(int i) Marshals a DER enumerated on the output stream. | public void | putGeneralString(String s) Marshals a string as a DER encoded GeneralString. | public void | putGeneralizedTime(Date d) Marshals a DER Generalized Time/date value.
YYYYMMDDhhmmss{Z|+hhmm|-hhmm} ... | public void | putIA5String(String s) Marshals a string as a DER encoded IA5String. | public void | putInteger(BigInteger i) Marshals a DER integer on the output stream. | public void | putInteger(Integer i) Marshals a DER integer on the output stream. | public void | putInteger(int i) Marshals a DER integer on the output stream. | public void | putLength(int len) Put the encoding of the length in the stream. | public void | putNull() Marshals a DER "null" value on the output stream. | public void | putOID(ObjectIdentifier oid) Marshals an object identifier (OID) on the output stream. | public void | putOctetString(byte[] octets) DER-encodes an ASN.1 OCTET STRING value on the output stream. | public void | putOrderedSet(byte tag, DerEncoder[] set) Marshals the contents of a set on the output stream. | public void | putOrderedSetOf(byte tag, DerEncoder[] set) Marshals the contents of a set on the output stream. | public void | putPrintableString(String s) Marshals a string as a DER encoded PrintableString. | public void | putSequence(DerValue[] seq) Marshals a sequence on the output stream. | public void | putSet(DerValue[] set) Marshals the contents of a set on the output stream without
ordering the elements. | public void | putT61String(String s) Marshals a string as a DER encoded T61String. | public void | putTag(byte tagClass, boolean form, byte val) Put the tag of the attribute in the stream. | public void | putUTCTime(Date d) Marshals a DER UTC time/date value.
YYMMDDhhmmss{Z|+hhmm|-hhmm} ... | public void | putUTF8String(String s) Marshals a string as a DER encoded UTF8String. | public void | putUnalignedBitString(BitArray ba) Marshals a DER bit string on the output stream. | public void | write(byte tag, byte[] buf) Writes tagged, pre-marshaled data. | public void | write(byte tag, DerOutputStream out) Writes tagged data using buffer-to-buffer copy. | public void | writeImplicit(byte tag, DerOutputStream value) Writes implicitly tagged data using buffer-to-buffer copy. |
DerOutputStream | public DerOutputStream(int size)(Code) | | Construct an DER output stream.
Parameters: size - how large a buffer to preallocate. |
DerOutputStream | public DerOutputStream()(Code) | | Construct an DER output stream.
|
putBMPString | public void putBMPString(String s) throws IOException(Code) | | Marshals a string as a DER encoded BMPString.
|
putBitString | public void putBitString(byte[] bits) throws IOException(Code) | | Marshals a DER bit string on the output stream. The bit
string must be byte-aligned.
Parameters: bits - the bit string, MSB first |
putBoolean | public void putBoolean(boolean val) throws IOException(Code) | | Marshals a DER boolean on the output stream.
|
putDerValue | public void putDerValue(DerValue val) throws IOException(Code) | | Marshals pre-encoded DER value onto the output stream.
|
putEnumerated | public void putEnumerated(int i) throws IOException(Code) | | Marshals a DER enumerated on the output stream.
Parameters: i - the enumerated value. |
putGeneralString | public void putGeneralString(String s) throws IOException(Code) | | Marshals a string as a DER encoded GeneralString.
|
putGeneralizedTime | public void putGeneralizedTime(Date d) throws IOException(Code) | | 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 2459.
|
putIA5String | public void putIA5String(String s) throws IOException(Code) | | Marshals a string as a DER encoded IA5String.
|
putInteger | public void putInteger(BigInteger i) throws IOException(Code) | | Marshals a DER integer on the output stream.
Parameters: i - the integer in the form of a BigInteger. |
putInteger | public void putInteger(Integer i) throws IOException(Code) | | Marshals a DER integer on the output stream.
Parameters: i - the integer in the form of an Integer. |
putInteger | public void putInteger(int i) throws IOException(Code) | | Marshals a DER integer on the output stream.
Parameters: i - the integer. |
putLength | public void putLength(int len) throws IOException(Code) | | Put the encoding of the length in the stream.
exception: IOException - on writing errors. |
putNull | public void putNull() throws IOException(Code) | | Marshals a DER "null" value on the output stream. These are
often used to indicate optional values which have been omitted.
|
putOID | public void putOID(ObjectIdentifier oid) throws IOException(Code) | | Marshals an object identifier (OID) on the output stream.
Corresponds to the ASN.1 "OBJECT IDENTIFIER" construct.
|
putOctetString | public void putOctetString(byte[] octets) throws IOException(Code) | | DER-encodes an ASN.1 OCTET STRING value on the output stream.
Parameters: octets - the octet string |
putOrderedSet | public void putOrderedSet(byte tag, DerEncoder[] set) throws IOException(Code) | | 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.
|
putOrderedSetOf | public void putOrderedSetOf(byte tag, DerEncoder[] set) throws IOException(Code) | | 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 | public void putPrintableString(String s) throws IOException(Code) | | Marshals a string as a DER encoded PrintableString.
|
putSequence | public void putSequence(DerValue[] seq) throws IOException(Code) | | 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 | public void putSet(DerValue[] set) throws IOException(Code) | | 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 | public void putT61String(String s) throws IOException(Code) | | Marshals a string as a DER encoded T61String.
|
putTag | public void putTag(byte tagClass, boolean form, byte val)(Code) | | Put the tag of the attribute in the stream.
|
putUTCTime | public void putUTCTime(Date d) throws IOException(Code) | | 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 2459.
|
putUTF8String | public void putUTF8String(String s) throws IOException(Code) | | Marshals a string as a DER encoded UTF8String.
|
putUnalignedBitString | public void putUnalignedBitString(BitArray ba) throws IOException(Code) | | Marshals a DER bit string on the output stream.
The bit strings need not be byte-aligned.
Parameters: bits - the bit string, MSB first |
write | public void write(byte tag, byte[] buf) throws IOException(Code) | | Writes tagged, pre-marshaled data. This calcuates and encodes
the length, so that the output data is the standard triple of
{ tag, length, data } used by all DER values.
Parameters: tag - the DER value tag for the data, such asDerValue.tag_Sequence Parameters: buf - buffered data, which must be DER-encoded |
write | public void write(byte tag, DerOutputStream out) throws IOException(Code) | | 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.
Parameters: tag - the DER value tag for the data, such asDerValue.tag_Sequence Parameters: out - buffered data |
writeImplicit | public void writeImplicit(byte tag, DerOutputStream value) throws IOException(Code) | | 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.
Parameters: tag - the DER value of the context-specific tag that replacesoriginal tag of the value in the output, such as in [N] IMPLICIT For example, FooLength [1] IMPLICIT INTEGER, with value=4;would be encoded as "81 01 04" whereas in explicittagging it would be encoded as "A1 03 02 01 04".Notice that the tag is A1 and not 81, this is because withexplicit tagging the form is always constructed. Parameters: value - original value being implicitly tagged |
|
|