=head1 NAME Convert::ASN1 - ASN.1 Encode/Decode library =head1 SYNOPSYS use Convert::ASN1; $asn = Convert::ASN1->new; $asn->prepare(q< [APPLICATION 7] SEQUENCE { int INTEGER, str OCTET STRING } >); $pdu = $asn->encode( int => 7, str => "string"); $out = $asn->decode($pdu); print $out->{int}," ",$out->{str},"\n"; use Convert::ASN1 qw(:io); $peer = asn_recv($sock,$buffer,0); $nbytes = asn_read($fh, $buffer); $nbytes = asn_send($sock, $buffer, $peer); $nbytes = asn_send($sock, $buffer); $nbytes = asn_write($fh, $buffer); $buffer = asn_get($fh); $yes = asn_ready($fh) =head1 DESCRIPTION Convert::ASN1 encodes and decodes ASN.1 data structures using BER/DER rules. =head1 METHODS =head2 new ( [OPTIONS] ) Contructor, creates a new object. If given, B are the same ones as for L below. =head2 error () Returns the last error. =head2 configure ( OPTIONS ) Configure options to control how Convert::ASN1 will perform various tasks. Options are passed as name-value pairs. =over 4 =item encode Reference to a hash which contains various encode options. =item decode Reference to a hash which contains various decode options. =item encoding One of 'BER' or 'DER'. The default is 'BER' =back Encode options =over 4 =item real Which encoding to use for real's. One of 'binary', 'nr1', 'nr2', 'nr3' =item time This controls how UTCTime and GeneralizedTime elements are encoded. The default is C. =over 4 =item utctime The value passed will be encoded without a zone, ie a UTC value. =item withzone The value will be encoded with a zone. By default it will be encoded using the local time offset. The offset may be set using the C configure option. =item raw The value passed should already be in the correct format and will be copied into the PDU as-is. =back =item timezone By default UTCTime and GeneralizedTime will be encoded using the local time offset from UTC. This will over-ride that. It is an offset from UTC in seconds. This option can be overriden by passing a reference to a list of two values as the time value. The list should contain the time value and the offset from UTC in seconds. =item bigint If during encoding an value greater than 32 bits is discovered and is not already a big integer object, then the value will first be converted into a big integer object. This option controls the big integer class into which the objects will be blessed. The default is to use Math::BigInt =back Decode options =over 4 =item time This controls how a UTCTime or a GeneralizedTime element will be decoded. The default is C. =over 4 =item utctime The value returned will be a time value as returned by the C