… | |
… | |
64 | |
64 | |
65 | my $buf = ber_encode $ber; |
65 | my $buf = ber_encode $ber; |
66 | |
66 | |
67 | =head1 DESCRIPTION |
67 | =head1 DESCRIPTION |
68 | |
68 | |
|
|
69 | WARNING: Before release 1.0, the API is not considered stable in any way. |
|
|
70 | |
69 | This module implements a I<very> low level BER/DER en-/decoder. |
71 | This module implements a I<very> low level BER/DER en-/decoder. |
70 | |
72 | |
71 | If is tuned for low memory and high speed, while still maintaining some |
73 | If is tuned for low memory and high speed, while still maintaining some |
72 | level of user-friendlyness. |
74 | level of user-friendlyness. |
73 | |
75 | |
… | |
… | |
164 | Thus, you can always decode a BER data structure and at worst you get a |
166 | Thus, you can always decode a BER data structure and at worst you get a |
165 | string in place of some nice decoded value. |
167 | string in place of some nice decoded value. |
166 | |
168 | |
167 | See the SYNOPSIS for an example of such an encoded tuple representation. |
169 | See the SYNOPSIS for an example of such an encoded tuple representation. |
168 | |
170 | |
|
|
171 | =head2 DECODING AND ENCODING |
|
|
172 | |
|
|
173 | =over |
|
|
174 | |
|
|
175 | =item $tuple = ber_decoded $bindata |
|
|
176 | |
|
|
177 | Decodes binary BER data in C<$bindata> and returns the resulting BER |
|
|
178 | tuple. Croaks on any decoding error, so the returned C<$tuple> is always |
|
|
179 | valid. |
|
|
180 | |
|
|
181 | =item $bindata = ber_encode $tuple |
|
|
182 | |
|
|
183 | Encodes the BER tuple into a BER/DER data structure. |
|
|
184 | |
|
|
185 | =back |
|
|
186 | |
169 | =head2 HELPER FUNCTIONS |
187 | =head2 HELPER FUNCTIONS |
170 | |
188 | |
171 | Working with a 4-tuple for every value can be annoying. Or, rather, I<is> |
189 | Working with a 4-tuple for every value can be annoying. Or, rather, I<is> |
172 | annoying. To reduce this a bit, this module defines a number of helper |
190 | annoying. To reduce this a bit, this module defines a number of helper |
173 | functions, both to match BER tuples and to conmstruct BER tuples: |
191 | functions, both to match BER tuples and to conmstruct BER tuples: |
… | |
… | |
269 | use common::sense; |
287 | use common::sense; |
270 | |
288 | |
271 | use XSLoader (); |
289 | use XSLoader (); |
272 | use Exporter qw(import); |
290 | use Exporter qw(import); |
273 | |
291 | |
274 | our $VERSION = 0.1; |
292 | our $VERSION = 0.2; |
275 | |
293 | |
276 | XSLoader::load __PACKAGE__, $VERSION; |
294 | XSLoader::load __PACKAGE__, $VERSION; |
277 | |
295 | |
278 | our %EXPORT_TAGS = ( |
296 | our %EXPORT_TAGS = ( |
279 | const => [qw( |
297 | const => [qw( |