1Convert::ASCII::Armour(U3s)er Contributed Perl DocumentatCioonnvert::ASCII::Armour(3)
2
3
4
6 Convert::ASCII::Armour - Convert binary octets into ASCII armoured mes‐
7 sages.
8
10 my $converter = new Convert::ASCII::Armour;
11
12 my $message = $converter->armour(
13 Object => "FOO RECORD",
14 Headers => {
15 Table => "FooBar",
16 Version => "1.23",
17 },
18 Content => {
19 Key => "0x8738FA7382",
20 Name => "Zoya Hall",
21 Pic => "....", # gif
22 },
23 Compress => 1,
24 );
25
26 print $message;
27
28 -----BEGIN COMPRESSED FOO RECORD-----
29 Version: 1.23
30 Table: FooBar
31
32 eJwzZzA0Z/BNLS5OTE8NycgsVgCiRIVciIAJg6EJg0tiSaqhsYJvYlFy...
33 XnpOZl5qYlJySmpaekZmVnZObl5+QWFRcUlpWXlFZRWXAk7g6OTs4urm...
34 Fh4VGaWAR5ehkbGJqZm5hSUeNXWKDsoGcWpaGpq68bba0dWxtTVmDOYM...
35 NzuZ
36 =MxpZvjkrv5XyhkVCuXmsBQ==
37 -----END COMPRESSED FOO RECORD-----
38
39 my $decoded = $converter->unarmour( $message )
40 ⎪⎪ die $converter->errstr();
41
43 This module converts hashes of binary octets into ASCII messages suit‐
44 able for transfer over 6-bit clean transport channels. The encoded
45 ASCII resembles PGP's armoured messages, but are in no way compatible
46 with PGP.
47
49 new()
50
51 Constructor.
52
53 armour()
54
55 Converts a hash of binary octets into an ASCII encoded message. The
56 encoded message has 4 parts: head and tail strings that act as identi‐
57 fiers and delimiters, a cluster of headers at top of the message,
58 Base64 encoded message body and a Base64 encoded MD5 digest of the mes‐
59 sage body. armour() takes a hash as argument with following keys:
60
61 Object
62 An identification string embedded in head and tail strings.
63
64 Content
65 Content is a hashref that contains the binary octets to be encoded.
66 This hash is serialized, compressed (if specified) and encoded into
67 ASCII with MIME::Base64. The result is the body of the encoded
68 message.
69
70 Headers
71 Headers is a hashref that contains ASCII headers that are placed at
72 top of the encoded message. Headers are encoded as RFC822 headers.
73
74 Compress
75 A boolean parameter that forces armour() to compress the message
76 body.
77
78 unarmour()
79
80 Decodes an armoured ASCII message into the hash provided as argument to
81 armour(). The hash contains Content, Object, and Headers. unarmour()
82 performs several consistency checks and returns a non-true value on
83 failure.
84
85 errstr()
86
87 Returns the error message set by unarmour() on failure.
88
90 Vipul Ved Prakash, <mail@vipul.net>
91
93 Copyright (c) 2001, Vipul Ved Prakash. All rights reserved. This code
94 is free software; you can redistribute it and/or modify it under the
95 same terms as Perl itself.
96
98 MIME::Base64(3), Compress::Zlib(3), Digest::MD5(3)
99
100
101
102perl v5.8.8 2007-04-17 Convert::ASCII::Armour(3)