1Convert::ASCII::Armour(U3s)er Contributed Perl DocumentatCioonnvert::ASCII::Armour(3)
2
3
4
6 Convert::ASCII::Armour - Convert binary octets into ASCII armoured
7 messages.
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
29 -----BEGIN COMPRESSED FOO RECORD-----
30 Version: 1.23
31 Table: FooBar
32
33 eJwzZzA0Z/BNLS5OTE8NycgsVgCiRIVciIAJg6EJg0tiSaqhsYJvYlFy...
34 XnpOZl5qYlJySmpaekZmVnZObl5+QWFRcUlpWXlFZRWXAk7g6OTs4urm...
35 Fh4VGaWAR5ehkbGJqZm5hSUeNXWKDsoGcWpaGpq68bba0dWxtTVmDOYM...
36 NzuZ
37 =MxpZvjkrv5XyhkVCuXmsBQ==
38 -----END COMPRESSED FOO RECORD-----
39
40
41 my $decoded = $converter->unarmour( $message )
42 || die $converter->errstr();
43
45 This module converts hashes of binary octets into ASCII messages
46 suitable for transfer over 6-bit clean transport channels. The encoded
47 ASCII resembles PGP's armoured messages, but are in no way compatible
48 with PGP.
49
51 new()
52 Constructor.
53
54 armour()
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
57 identifiers and delimiters, a cluster of headers at top of the message,
58 Base64 encoded message body and a Base64 encoded MD5 digest of the
59 message 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 Decodes an armoured ASCII message into the hash provided as argument to
80 armour(). The hash contains Content, Object, and Headers. unarmour()
81 performs several consistency checks and returns a non-true value on
82 failure.
83
84 errstr()
85 Returns the error message set by unarmour() on failure.
86
88 Vipul Ved Prakash, <mail@vipul.net>
89
91 Copyright (c) 2001, Vipul Ved Prakash. All rights reserved. This code
92 is free software; you can redistribute it and/or modify it under the
93 same terms as Perl itself.
94
96 MIME::Base64(3), Compress::Zlib(3), Digest::MD5(3)
97
98
99
100perl v5.38.0 2023-07-20 Convert::ASCII::Armour(3)