line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::OpenToken::Cipher::AES128; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
16
|
use Moose; |
|
2
|
|
|
|
|
63
|
|
|
2
|
|
|
|
|
18
|
|
4
|
2
|
|
|
2
|
|
15446
|
use Crypt::Rijndael; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
273
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Crypt::OpenToken::Cipher'; |
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
1
|
28
|
sub keysize { 16 } |
9
|
9
|
|
|
9
|
1
|
35
|
sub iv_len { 16 } |
10
|
|
|
|
|
|
|
sub cipher { |
11
|
9
|
|
|
9
|
1
|
30
|
my ($self, $key, $iv) = @_; |
12
|
9
|
|
|
|
|
125
|
my $crypto = Crypt::Rijndael->new($key, Crypt::Rijndael::MODE_CBC()); |
13
|
9
|
|
|
|
|
35
|
$crypto->set_iv($iv); |
14
|
9
|
|
|
|
|
26
|
return $crypto; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Crypt::OpenToken::Cipher::AES128 - AES128 encryption support for OpenToken |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This library can be used by C<Crypt::OpenToken> to encrypt payloads using |
26
|
|
|
|
|
|
|
AES-128 encryption. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item keysize() |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns the key size used for AES-128 encryption; 16 bytes. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item iv_len() |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Returns the length of the Initialization Vector needed for AES-128 encryption; |
39
|
|
|
|
|
|
|
16 bytes. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item cipher($key, $iv) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Returns a C<Crypt::CBC> compatible cipher the implements the AES-128 |
44
|
|
|
|
|
|
|
encryption. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=back |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 AUTHOR |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Graham TerMarsch (cpan@howlingfrog.com) |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
C<Crypt::OpenToken> is Copyright (C) 2010, Socialtext, and is released under |
55
|
|
|
|
|
|
|
the Artistic-2.0 license. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SEE ALSO |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
L<Crypt::OpenToken::Cipher> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |