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