c4e_asn1.h File Reference

(Version 341)

ASN.1. More...

Go to the source code of this file.

Defines

#define C4E_ASN1_TAG_NUM_MASK
#define C4E_ASN1_TAG_PRIMCONST_MASK
#define C4E_ASN1_TAG_CLASS_MASK
#define C4E_ASN1_TAG_CLASS_UNIVERSAL
#define C4E_ASN1_TAG_CLASS_APPLICATION
#define C4E_ASN1_TAG_CLASS_CONTEXT
#define C4E_ASN1_TAG_CLASS_PRIVATE
#define C4E_ASN1_TAG_PRIMITIVE
#define C4E_ASN1_TAG_CONSTRUCTED
#define C4E_ASN1_TAG_ID_BOOLEAN
#define C4E_ASN1_TAG_ID_INTEGER
#define C4E_ASN1_TAG_ID_BITSTRING
#define C4E_ASN1_TAG_ID_OCTETSTRING
#define C4E_ASN1_TAG_ID_NULL
#define C4E_ASN1_TAG_ID_OID
#define C4E_ASN1_TAG_ID_UTF8STRING
#define C4E_ASN1_TAG_ID_PRINTSTRING
#define C4E_ASN1_TAG_ID_T61STRING
#define C4E_ASN1_TAG_ID_IA5STRING
#define C4E_ASN1_TAG_ID_UTCTIME
#define C4E_ASN1_TAG_ID_SEQUENCE
#define C4E_ASN1_TAG_ID_SET
#define C4E_ASN1_TAG_NUM_MULTIBYTE
#define C4E_ASN1_LEN_SIZE

Functions

C4E_CONST C4eArchUint8c4e_asn1_expect_tag (C4E_CONST C4eArchUint8 *C4E_RESTRICT tlv, C4eArchUint8 tag, C4eArchSize *C4E_RESTRICT plen, C4eElement *C4E_RESTRICT asn1len)
 Expects a particular ASN.1 BER encoded tag and returns a pointer to it's content field.

Detailed Description

ASN.1.

Author:
Copyright (C) 2010 Ralf Hoppe <ralf.hoppe@ieee.org>
Version:
Id
c4e_asn1.h 341 2014-07-12 16:27:35Z ralf
Bibliography:
Information Technology — ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER). ITU-T Recommendation X.690, November 208.

Definition in file c4e_asn1.h.


Define Documentation

#define C4E_ASN1_TAG_NUM_MASK

mask for ASN.1 tag Number

Definition at line 32 of file c4e_asn1.h.

#define C4E_ASN1_TAG_PRIMCONST_MASK

mask for ASN.1 tag bit Primtive/Constructed

Definition at line 33 of file c4e_asn1.h.

#define C4E_ASN1_TAG_CLASS_MASK

mask for ASN.1 tag Class

Definition at line 34 of file c4e_asn1.h.

#define C4E_ASN1_TAG_CLASS_UNIVERSAL

ASN.1 tag class Universal

Definition at line 36 of file c4e_asn1.h.

#define C4E_ASN1_TAG_CLASS_APPLICATION

ASN.1 tag class Application

Definition at line 37 of file c4e_asn1.h.

#define C4E_ASN1_TAG_CLASS_CONTEXT

ASN.1 tag class Context-specific

Definition at line 38 of file c4e_asn1.h.

#define C4E_ASN1_TAG_CLASS_PRIVATE

ASN.1 tag class Private

Definition at line 39 of file c4e_asn1.h.

#define C4E_ASN1_TAG_PRIMITIVE

ASN.1 tag bit Primitive

Definition at line 41 of file c4e_asn1.h.

#define C4E_ASN1_TAG_CONSTRUCTED

ASN.1 tag bit Constructed

Definition at line 42 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_BOOLEAN

ASN.1 tag ID BOOLEAN

Definition at line 44 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_INTEGER

ASN.1 tag ID INTEGER

Definition at line 45 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_BITSTRING

ASN.1 tag ID BIT STRING

Definition at line 46 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_OCTETSTRING

ASN.1 tag ID OCTET STRING

Definition at line 47 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_NULL

ASN.1 tag ID NULL

Definition at line 48 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_OID

ASN.1 tag ID OBJECT IDENTIFIER

Definition at line 49 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_UTF8STRING

ASN.1 tag ID UTF8 STRING

Definition at line 50 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_PRINTSTRING

ASN.1 tag ID PRINTABLE STRING

Definition at line 51 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_T61STRING

ASN.1 tag ID T61 STRING (Teletex)

Definition at line 52 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_IA5STRING

ASN.1 tag ID IA5 STRING (ASCII)

Definition at line 53 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_UTCTIME

ASN.1 tag ID UTC TIME

Definition at line 54 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_SEQUENCE

ASN.1 tag ID SEQUENCE

Definition at line 55 of file c4e_asn1.h.

#define C4E_ASN1_TAG_ID_SET

ASN.1 tag ID SET

Definition at line 56 of file c4e_asn1.h.

#define C4E_ASN1_TAG_NUM_MULTIBYTE

coding for ASN.1 multi-byte tags

Definition at line 58 of file c4e_asn1.h.

#define C4E_ASN1_LEN_SIZE

Supported number of bytes for the length field, when long (definite) form is used.

Note:
ITU-T X.690 allows a length coding by at most 126 bytes, which results in a maximum content length of 2^1008 bytes. Because the current implementation does not include a true ASN.1 parser, this limit can be reduced.

Definition at line 70 of file c4e_asn1.h.


Function Documentation

C4E_CONST C4eArchUint8* c4e_asn1_expect_tag ( C4E_CONST C4eArchUint8 *C4E_RESTRICT  tlv,
C4eArchUint8  tag,
C4eArchSize *C4E_RESTRICT  plen,
C4eElement *C4E_RESTRICT  asn1len 
)

Expects a particular ASN.1 BER encoded tag and returns a pointer to it's content field.

Bibliography:
Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER). ITU-T X.690, 11/2008.
Parameters:
[in] tlv Pointer to BER (DER) encoded data, starting with a tag byte.
[in] tag Tag (less than 31) to be expected at start of tlv.
[in,out] plen Pointer to (maximum) length of data in tlv. As an output parameter it is decremented by the number of bytes consumed by the tag and length field.
[out] asn1len Length of contents as a big integer (normalized).
Returns:
On success returns a pointer to the contents field (one byte after the end of length field). On error it returns NULL.