asn(n) | ASN.1 processing | asn(n) |
asn - ASN.1 BER encoder/decoder
package require Tcl 8.4
package require asn ?0.8.3?
::asn::asnSequence evalue...
::asn::asnSequenceFromList elist
::asn::asnSet evalue...
::asn::asnSetFromList elist
::asn::asnApplicationConstr appNumber evalue...
::asn::asnApplication appNumber data
::asn::asnChoice appNumber evalue...
::asn::asnChoiceConstr appNumber evalue...
::asn::asnInteger number
::asn::asnEnumeration number
::asn::asnBoolean bool
::asn::asnContext context data
::asn::asnContextConstr context evalue...
::asn::asnObjectIdentifier idlist
::asn::asnUTCTime utcstring
::asn::asnNull
::asn::asnBitString string
::asn::asnOctetString string
::asn::asnNumericString string
::asn::asnPrintableString string
::asn::asnIA5String string
::asn::asnBMPString string
::asn::asnUTF8String string
::asn::asnString string
::asn::defaultStringType ?type?
::asn::asnPeekByte data_var byte_var
::asn::asnGetLength data_var length_var
::asn::asnGetResponse chan data_var
::asn::asnGetInteger data_var int_var
::asn::asnGetEnumeration data_var enum_var
::asn::asnGetOctetString data_var string_var
::asn::asnGetString data_var string_var ?type_var?
::asn::asnGetNumericString data_var string_var
::asn::asnGetPrintableString data_var string_var
::asn::asnGetIA5String data_var string_var
::asn::asnGetBMPString data_var string_var
::asn::asnGetUTF8String data_var string_var
::asn::asnGetUTCTime data_var utc_var
::asn::asnGetBitString data_var bits_var
::asn::asnGetObjectIdentifier data_var oid_var
::asn::asnGetBoolean data_var bool_var
::asn::asnGetNull data_var
::asn::asnGetSequence data_var sequence_var
::asn::asnGetSet data_var set_var
::asn::asnGetApplication data_var appNumber_var ?content_var? ?encodingType_var?
::asn::asnGetContext data_var contextNumber_var ?content_var? ?encodingType_var?
::asn::asnPeekTag data_var tag_var tagtype_var constr_var
::asn::asnTag tagnumber ?class? ?tagstyle?
::asn::asnRetag data_var newTag
The asn package provides partial de- and encoder commands for BER encoded ASN.1 data. It can also be used for decoding DER, which is a restricted subset of BER.
ASN.1 is a standard Abstract Syntax Notation, and BER are its Basic Encoding Rules.
See http://asn1.elibel.tm.fr/en/standards/index.htm for more information about the standard.
Also see http://luca.ntop.org/Teaching/Appunti/asn1.html for A Layman's Guide to a Subset of ASN.1, BER, and DER, an RSA Laboratories Technical Note by Burton S. Kaliski Jr. (Revised November 1, 1993). A text version of this note is part of the module sources and should be read by any implementor.
General notes:
If the optional third argument type_var is supplied, then the type of the incoming string is stored in the variable named by it.
The function throws the error "Invalid command name asnGetSomeUnsupportedString" if the unsupported string type Unsupported is encountered. You can create the appropriate function "asn::asnGetSomeUnsupportedString" in your application if neccessary.
The data in sequence_var is encoded binary and has to be further decoded according to the definition of the sequence, using the decoder commands here.
The data in set_var is encoded binary and has to be further decoded according to the definition of the set, using the decoder commands here.
Otherwise it is the responsibility of the caller to decode the remainder of the application construct based on the id retrieved by this command, using the decoder commands of this package.
Otherwise it is the responsibility of the caller to decode the remainder of the construct based on the id retrieved by this command, using the decoder commands of this package.
Working with ASN.1 you often need to decode tagged values, which use a tag thats different from the universal tag for a type. In those cases you have to replace the tag with the universal tag used for the type, to decode the value. To decode a tagged value use the ::asn::asnRetag to change the tag to the appropriate type to use one of the decoders for primitive values. To help with this the module contains three functions:
Examples for the usage of this package can be found in the implementation of package ldap.
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category asn of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation.
asn, ber, cer, der, internet, protocol, x.208, x.209
Networking
Copyright (c) 2004 Andreas Kupries <andreas_kupries@users.sourceforge.net> Copyright (c) 2004 Jochen Loewer <loewerj@web.de> Copyright (c) 2004-2008 Michael Schlenker <mic42@users.sourceforge.net>
0.8 | asn |