PackageDescription: ASN1
ASN 1Last published: April 2, 2008 by 'kgreek'
Defines 12 Classes
Extends 60 Classes
This package implements encoding/decoding machinery aimed at two most commong ASN.1 encodings, BER and DER. The framework supports two modes of marshaling (1) type-in-hand marshaling and (2) type-agnostic or raw marshaling. The former is the usual way, because the meta-information represented by the type instances is often necessary to follow the structure of the encoding. In this mode the application provides the root type to use to marshal/unmarshal an object to/from a stream. The API for this mode is #marshalObject:withType: and #unmarshalObjectType:. The "raw" mode can be used for investigation of an encoding produced by an unknown ASN.1 application or to marshal a smalltalk object using a sort of default Smalltalk-to-ASN.1 mapping. This mode will usually be only useful during development and prototyping. The API for this mode is #marshalObject and #unmarshalObject.
The marshaling streams (TLVStream hierarchy) can be customized via pluggable EncodingPolicy. The policy will receive callbacks from the stream during the marshaling/unmarshaling process as it follows the driving type structure. The policy can be used for various purposes. This package includes a RetainEncodings policy which will capture the bytes representing particular objects in the structure being (un)marshaled. Another example is the PrettyPrinter encoding which produces an indented textual representation of the encoded contents onto a text stream.
LIMITATIONS:
- tags encoded in multiple bytes will probably cause problems
- exception markers are ignored
- some valid BER encodings may not work (indefinite lenght is not supported, etc)
- marshaling of some of the string types, REAL and RELATIVE_OID are not yet supported (see 'encoding/decoding - unimplemented' protocols on BERStreamDefinite)