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