asn Struct Reference

#include <asn.h>

Inheritance diagram for asn:

Inheritance graph
Collaboration diagram for asn:

Collaboration graph

Detailed Description

Internal data type used for ASN.1 BER/DER encoding/decoding.


Public Member Functions

Constructors
 asn ()
 Constructor for an empty object.
 asn (const asn &x)
 Copy constructor.
 asn (const str &x)
 Constructor based on a cdk::str object.
 asn (tags tag, const str &x, double extra)
 Constructor based on tag and body (allowing additional space for additions).
Assignment and Concatenation Operators
asn operator= (const str &x)
 Assign a string to this object.
asn operator= (const asn &x)
 Assign another asn object to this one.
asn operator+= (const str &x)
 Concatenate a str object onto this one.
Predicates
bool isParseable () const
 Predicate used to detect if object can be parsed as a sequence of ANS.1 records.
Inspectors
int parseoid (int &alg, int &hashtype) const
 Parse this object for an algorithm ID and hash function type.
Conversions
asn tobin () const
 Decode object, converting base-64 encoded data to binary if necessary.
str getText () const
 Decode object, converting text from Unicode to UTF8 if necessary.
str dump (int level) const
 Convert object to a printable string for display purposes.

Static Public Member Functions

static asn name (int code, const str &name)
 Encode a name as a UTF8String.
static asn email (const str &address)
 Encode an e-mail address as an IA5String.
static asn date (TimeT t1)
 Encode a UNIX date (chosing between UTCTime or GeneralizedTime to match input).
static asn integer (int x)
 Encode a small integer.
static asn integer (const num &x)
 Encode a num as an INTEGER.
static asn Int_ (int &x, tags t=Int)
 Encode a small integer or boolean value.
static asn Date_ (TimeT &x)
 Encode a date.


Member Function Documentation

static asn date ( TimeT  t1  )  [static]

Encode a UNIX date (chosing between UTCTime or GeneralizedTime to match input).

Parameters:
t1 the UNIX date to be encoded
Returns:
an object containing the encoded date

static asn Date_ ( TimeT x  )  [static]

Encode a date.

Parameters:
x the value to be encoded
Returns:
an object containing the input value in GeneralizedTime format

str dump ( int  level  )  const

Convert object to a printable string for display purposes.

Parameters:
level the number of levels to recurse into the ASN.1 record
Returns:
a cdk::str containing a printable representation of contents of this object

static asn email ( const str address  )  [static]

Encode an e-mail address as an IA5String.

Parameters:
address the address to be encoded
Returns:
an object containing the encoded e-mail address

str getText (  )  const

Decode object, converting text from Unicode to UTF8 if necessary.

Returns:
a cdk::str representation of the text contained in this object

static asn Int_ ( int &  x,
tags  t = Int 
) [static]

Encode a small integer or boolean value.

Parameters:
x the value to be encoded
t the desired tag (defaults to INTEGER)
Returns:
an object containing the tagged input value as a variable-length integer

static asn integer ( const num x  )  [inline, static]

Encode a num as an INTEGER.

Parameters:
x the value to be encoded
Returns:
an object containing the DER-encoded integer

static asn integer ( int  x  )  [static]

Encode a small integer.

Parameters:
x the value to be encoded
Returns:
an object containing the the DER-encoded integer

static asn name ( int  code,
const str name 
) [static]

Encode a name as a UTF8String.

Parameters:
code the name to be encoded
name the name to be encoded
Returns:
an object containing the encoded name

asn operator+= ( const str x  )  [inline]

Concatenate a str object onto this one.

Parameters:
x the asn tring to be copied

Reimplemented from str.

asn operator= ( const asn x  )  [inline]

Assign another asn object to this one.

Parameters:
x the asn tring to be copied

asn operator= ( const str x  )  [inline]

Assign a string to this object.

Parameters:
x the string to be copied into this object

Reimplemented from str.

int parseoid ( int &  alg,
int &  hashtype 
) const

Parse this object for an algorithm ID and hash function type.

Parameters:
alg output parameter to receive algorithm ID
hashtype output parameter to receive hash function ID

asn tobin (  )  const

Decode object, converting base-64 encoded data to binary if necessary.

Returns:
a new asn object containing the base-64 decoded data


The documentation for this struct was generated from the following file:
ISC Cryptographic Development Kit - User's Guide
ISC website
Questions? E-mail ISC technical support
Copyright© 2002-2006 Information Security Corp. All rights reserved.