line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::OpenPGP::UserID; |
2
|
5
|
|
|
5
|
|
357
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
173
|
|
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
29
|
use Crypt::OpenPGP::ErrorHandler; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
157
|
|
5
|
5
|
|
|
5
|
|
28
|
use base qw( Crypt::OpenPGP::ErrorHandler ); |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
1530
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
30
|
|
|
30
|
1
|
2872
|
my $id = bless { }, shift; |
9
|
30
|
|
|
|
|
107
|
$id->init(@_); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
30
|
|
|
30
|
0
|
47
|
my $id = shift; |
14
|
30
|
|
|
|
|
66
|
my %param = @_; |
15
|
30
|
100
|
|
|
|
104
|
if (my $ident = $param{Identity}) { |
16
|
3
|
|
|
|
|
20
|
$id->{id} = $ident; |
17
|
|
|
|
|
|
|
} |
18
|
30
|
|
|
|
|
79
|
$id; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
47
|
|
|
47
|
1
|
318
|
sub id { $_[0]->{id} } |
22
|
|
|
|
|
|
|
sub parse { |
23
|
27
|
|
|
27
|
1
|
60
|
my $class = shift; |
24
|
27
|
|
|
|
|
52
|
my($buf) = @_; |
25
|
27
|
|
|
|
|
92
|
my $id = $class->new; |
26
|
27
|
|
|
|
|
92
|
$id->{id} = $buf->bytes; |
27
|
27
|
|
|
|
|
313
|
$id; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
7
|
1
|
26
|
sub save { $_[0]->{id} } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Crypt::OpenPGP::UserID - PGP User ID packet |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Crypt::OpenPGP::UserID; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $uid = Crypt::OpenPGP::UserID->new( Identity => 'Foo' ); |
44
|
|
|
|
|
|
|
my $serialized = $uid->save; |
45
|
|
|
|
|
|
|
my $identity = $uid->id; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
I<Crypt::OpenPGP::UserID> is a PGP User ID packet. Such a packet is |
50
|
|
|
|
|
|
|
used to represent the name and email address of the key holder, |
51
|
|
|
|
|
|
|
and typically contains an RFC822 mail name like |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Foo Bar <foo@bar.com> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 USAGE |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 Crypt::OpenPGP::UserID->new( [ Identity => $identity ] ) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Creates a new User ID packet object and returns that object. If you |
60
|
|
|
|
|
|
|
do not supply an identity, the object is created empty; this is used, |
61
|
|
|
|
|
|
|
for example, in I<parse> (below), to create an empty packet which is |
62
|
|
|
|
|
|
|
then filled from the data in the buffer. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
If you wish to initialize a non-empty object, supply I<new> with |
65
|
|
|
|
|
|
|
the I<Identity> parameter along with a value I<$identity> which |
66
|
|
|
|
|
|
|
should generally be in RFC822 form (above). |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 $uid->save |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Returns the text of the user ID packet; this is the string passed to |
71
|
|
|
|
|
|
|
I<new> (above) as I<$identity>, for example. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 Crypt::OpenPGP::UserID->parse($buffer) |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Given I<$buffer>, a I<Crypt::OpenPGP::Buffer> object holding (or |
76
|
|
|
|
|
|
|
with offset pointing to) a User ID packet, returns a new |
77
|
|
|
|
|
|
|
<Crypt::OpenPGP::UserID> object, initialized with the user ID data |
78
|
|
|
|
|
|
|
in the buffer. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 $uid->id |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns the user ID data (eg. the string passed as I<$identity> to |
83
|
|
|
|
|
|
|
I<new>, above). |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR & COPYRIGHTS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Please see the Crypt::OpenPGP manpage for author, copyright, and |
88
|
|
|
|
|
|
|
license information. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |