line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Perl::Cipher::AES_CBC; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
51
|
|
|
2
|
|
|
|
|
63
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
20
|
use Net::SSH::Perl::Cipher; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
6
|
2
|
|
|
2
|
|
11
|
use base qw( Net::SSH::Perl::Cipher ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
323
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
905
|
use Net::SSH::Perl::Cipher::CBC; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
61
|
|
9
|
2
|
|
|
2
|
|
1030
|
use Crypt::Cipher::AES; |
|
2
|
|
|
|
|
1428
|
|
|
2
|
|
|
|
|
514
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
7
|
|
|
7
|
1
|
21
|
my $class = shift; |
13
|
7
|
|
|
|
|
19
|
my $ciph = bless { }, $class; |
14
|
7
|
100
|
|
|
|
48
|
$ciph->init(@_) if @_; |
15
|
7
|
|
|
|
|
26
|
$ciph; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
0
|
0
|
|
sub keysize { } # stub |
19
|
10
|
|
|
10
|
0
|
75
|
sub blocksize { 16 } # 128 bits as required by AES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init { |
22
|
7
|
|
|
7
|
0
|
16
|
my $ciph = shift; |
23
|
7
|
|
|
|
|
19
|
my($key, $iv) = @_; |
24
|
|
|
|
|
|
|
|
25
|
7
|
|
|
|
|
36
|
$key = substr($key,0,$ciph->keysize); |
26
|
7
|
|
|
|
|
108
|
my $aes = Crypt::Cipher::AES->new($key); |
27
|
7
|
|
|
|
|
34
|
$ciph->{cbc} = Net::SSH::Perl::Cipher::CBC->new($aes, substr($iv,0,$ciph->blocksize)); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub encrypt { |
31
|
3
|
|
|
3
|
1
|
1819
|
my($ciph, $text) = @_; |
32
|
3
|
|
|
|
|
19
|
return $ciph->{cbc}->encrypt($text); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub decrypt { |
36
|
4
|
|
|
4
|
1
|
23
|
my($ciph, $text) = @_; |
37
|
4
|
|
|
|
|
15
|
return $ciph->{cbc}->decrypt($text); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |