cryptix.asn1.encoding

Class DER

Implemented Interfaces:
CoderOperations, ParserVisitor

public class DER
extends BaseCoder

A concrete factory class to handle ASN.1 DER encoding.

Portions of this class's code are ported from the "Unsupported Release of the Certificate Library" in C++ from Sun Microsystems' Internet Commerce Group (see copyright notice later). Copyright ©1997, 1998, 1999 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.3 $

Authors:
Raif S. Naffah
Eric Rescorla

Nested Class Summary

(package private) class
DER.Component

Field Summary

Fields inherited from class cryptix.asn1.encoding.BaseCoder

in, out

Fields inherited from interface cryptix.asn1.encoding.CoderOperations

DECODING, ENCODING, UNINITIALIZED

Method Summary

void
decode(InputStream in, int level)
void
decode(ASNAny obj, InputStream in)
Decodes an ANY, represented as byte[] -- EKR
void
decode(ASNBitString obj, InputStream in)
Decodes a BIT STRING --internally represented as a byte[].
void
decode(ASNBoolean obj, InputStream in)
Decodes a BOOLEAN --internally represented as a Boolean.
void
decode(ASNInteger obj, InputStream in)
Decodes an INTEGER -- internally represented as a BigInteger.
void
decode(ASNNull obj, InputStream in)
Decodes a NULL --internally represented as a null.
void
decode(ASNObjectIdentifier obj, InputStream in)
Decodes an OID --internally represented as a dot-separated String.
void
decode(ASNOctetString obj, InputStream in)
Decodes an OCTET STRING --internally represented as a byte[].
void
decode(ASNPrintableString obj, InputStream in)
Decodes a PrintableString --internally represented as a String.
void
decode(ASNSequence obj, InputStream in)
Decodes a SEQUENCE --internally represented as an array.
void
decode(ASNSequenceOf obj, InputStream in)
Decodes a SEQUENCE OF --internally represented as an array.
void
decode(ASNSet obj, InputStream in)
Decodes a SET --internally represented as an array.
void
decode(ASNSetOf obj, InputStream in)
Decodes a SET OF --internally represented as an array.
void
decode(ASNTaggedType obj, InputStream in)
Decodes a Tagged Type -- rewritten by EKR
void
decode(ASNTime obj, InputStream in)
Decodes a UTCTime --internally represented as a Date.
void
decodeExplicitTaggedType(ASNTaggedType obj, InputStream in)
Decodes an EXPLICIT Tagged Type.
boolean
decodeImplicitTaggedType(ASNTaggedType obj, InputStream in)
Decodes an IMPLICIT Tagged Type.
void
encode(ASNBoolean obj, OutputStream out)
Encodes a BOOLEAN.
void
encode(ASNNull obj, OutputStream out)
Encodes a NULL.
void
encode(ASNObjectIdentifier obj, OutputStream out)
Encodes an OID.
void
encode(ASNOctetString obj, OutputStream out)
Encodes an OCTET STRING.
void
encode(ASNSequence obj, OutputStream out)
Encodes a SEQUENCE.
void
encode(ASNTaggedType obj, OutputStream out)
Encodes an ASN.1 Tagged type.
void
encode(ASNTime obj, OutputStream out)
Encodes a UTCTime.

Methods inherited from class cryptix.asn1.encoding.BaseCoder

decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, decode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, encode, getInstance, getState, init, init, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitInternal

Method Details

decode

public void decode(InputStream in,
                   int level)
            throws IOException

decode

public void decode(ASNAny obj,
                   InputStream in)
            throws IOException
Decodes an ANY, represented as byte[] -- EKR
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNBitString obj,
                   InputStream in)
            throws IOException
Decodes a BIT STRING --internally represented as a byte[].
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNBoolean obj,
                   InputStream in)
            throws IOException
Decodes a BOOLEAN --internally represented as a Boolean.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNInteger obj,
                   InputStream in)
            throws IOException
Decodes an INTEGER -- internally represented as a BigInteger.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNNull obj,
                   InputStream in)
            throws IOException
Decodes a NULL --internally represented as a null.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNObjectIdentifier obj,
                   InputStream in)
            throws IOException
Decodes an OID --internally represented as a dot-separated String.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNOctetString obj,
                   InputStream in)
            throws IOException
Decodes an OCTET STRING --internally represented as a byte[].
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNPrintableString obj,
                   InputStream in)
            throws IOException
Decodes a PrintableString --internally represented as a String.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNSequence obj,
                   InputStream in)
            throws IOException
Decodes a SEQUENCE --internally represented as an array.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNSequenceOf obj,
                   InputStream in)
            throws IOException
Decodes a SEQUENCE OF --internally represented as an array.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNSet obj,
                   InputStream in)
            throws IOException
Decodes a SET --internally represented as an array.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNSetOf obj,
                   InputStream in)
            throws IOException
Decodes a SET OF --internally represented as an array.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNTaggedType obj,
                   InputStream in)
            throws IOException
Decodes a Tagged Type -- rewritten by EKR
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decode

public void decode(ASNTime obj,
                   InputStream in)
            throws IOException
Decodes a UTCTime --internally represented as a Date.
Specified by:
decode in interface CoderOperations
Overrides:
decode in interface BaseCoder

decodeExplicitTaggedType

public void decodeExplicitTaggedType(ASNTaggedType obj,
                                     InputStream in)
            throws IOException
Decodes an EXPLICIT Tagged Type.

decodeImplicitTaggedType

public boolean decodeImplicitTaggedType(ASNTaggedType obj,
                                        InputStream in)
            throws IOException
Decodes an IMPLICIT Tagged Type.

encode

public void encode(ASNBoolean obj,
                   OutputStream out)
            throws IOException
Encodes a BOOLEAN.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder

encode

public void encode(ASNNull obj,
                   OutputStream out)
            throws IOException
Encodes a NULL.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder

encode

public void encode(ASNObjectIdentifier obj,
                   OutputStream out)
            throws IOException
Encodes an OID. OIDs are represented as dotted strings.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder

encode

public void encode(ASNOctetString obj,
                   OutputStream out)
            throws IOException
Encodes an OCTET STRING.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder

encode

public void encode(ASNSequence obj,
                   OutputStream out)
            throws IOException
Encodes a SEQUENCE.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder

encode

public void encode(ASNTaggedType obj,
                   OutputStream out)
            throws IOException
Encodes an ASN.1 Tagged type.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder

encode

public void encode(ASNTime obj,
                   OutputStream out)
            throws IOException
Encodes a UTCTime.
Specified by:
encode in interface CoderOperations
Overrides:
encode in interface BaseCoder