1VOMS::Lite::ASN1Helper(U3s)er Contributed Perl DocumentatViOoMnS::Lite::ASN1Helper(3)
2
3
4
6 VOMS::Lite::ASN1Helper - Perl extension for basic ASN.1 encoding and
7 decoding. There is no OO in this module, it's a very basic
8 straightforward implementation of ASN.1.
9
11 use VOMS::Lite::ASN1Helper qw( Hex DecToHex ASN1BitStr ASN1Wrap ASN1UnwrapHex ASNLenStr ASN1Index ASN1Unwrap ASN1OIDtoOID);
12
13 # To convert a binary string, $data, to padded hex i.e. ([0-9a-f]{2})*
14 my $hexstr=Hex($data);
15
16 # To convert an integer to a padded string of hex values
17 my $hexint=DecToHex($int);
18
19 # To convert ASN1 represeantation of an OID to a dot representation e.g. 1.2.840.113549.1.9.1
20 my $OIDstr=ASN1OIDtoOID($data);
21
22 # To convert a dot representation of an OID (e.g. 1.2.840.113549.1.9.1) to an ASN1 represeantation
23 my $ASN1str=OIDtoASN1OID($oid);
24
25 # To convert a hex representation of a N*8 bit bytestring into an ASN1 bitstring
26 my $hexbitstr=ASN1BitStr($hexstr);
27 my $hexbitstr=ASN1BitStr($hexstr,$lengthinbits);
28
29 # To wrap a hex string into an ASN.1 Primative
30 my $objectstr=30; #30 denotes a SEQUENCE
31 my $asn1prim=ASN1Wrap($hexstr);
32
33 # To unwrap a chunk of BER encoded ASN.1
34 my $contents=ASN1Unwrap($data);
35 my $contentshex=ASN1UnwrapHex($data);
36 # or
37 my ($headerLength,$dataLength,$class,$constructed,$tag,$contents)=ASN1Unwrap($data);
38
39 # To return the ASN.1 length header for a hex representation of some data
40 my $LenghtHeaderHex=ASNLenStr($hexstr);
41
42 # To index an ASN.1 string
43 foreach ASN1Index($data) {
44 my ($class,$constructed,$tag,$position,$headLength,$dataLength)=@$_;
45 ...
46 }
47
49 VOMS::Lite::ASN1Helper is designed to provide simple ASN.1 encoding
50 decoding methods for VOMS::Lite.
51
52 EXPORT
53 None by default.
54
55 By EXPORT_OK the following functions:
56 Hex
57 DecToHex
58 ASN1BitStr
59 ASN1Wrap
60 ASN1UnwrapHex
61 ASNLenStr
62 ASN1Index
63 ASN1Unwrap
64 ASN1OIDtoOID
65 OIDtoASN1OID
66
68 The X.680 and X.690 specifications:
69 http://www.itu.int/ITU-T/studygroups/com17/languages/
70
71 This module was originally designed for the SHEBANGS project at The
72 University of Manchester.
73 http://www.mc.manchester.ac.uk/projects/shebangs/ now
74 http://www.rcs.manchester.ac.uk/research/shebangs/
75
76 Mailing list, shebangs@listserv.manchester.ac.uk Mailing list,
77 voms-lite@listserv.manchester.ac.uk
78
79 If you have a mailing list set up for your module, mention it here.
80
81 If you have a web site set up for your module, mention it here.
82
84 Mike Jones <mike.jones@manchester.ac.uk>
85
87 Copyright (C) 2006 by Mike Jones
88
89 This library is free software; you can redistribute it and/or modify it
90 under the same terms as Perl itself, either Perl version 5.8.3 or, at
91 your option, any later version of Perl 5 you may have available.
92
93
94
95perl v5.12.3 2011-03-17 VOMS::Lite::ASN1Helper(3)