line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SSH::Perl::Cipher::AES_CTR; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use Net::SSH::Perl::Cipher; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
6
|
use base qw( Net::SSH::Perl::Cipher ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
94
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
421
|
use Net::SSH::Perl::Cipher::CTR; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
9
|
1
|
|
|
1
|
|
357
|
use Crypt::Cipher::AES; |
|
1
|
|
|
|
|
1414
|
|
|
1
|
|
|
|
|
272
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
6
|
|
|
6
|
1
|
26
|
my $class = shift; |
13
|
6
|
|
|
|
|
20
|
my $ciph = bless { }, $class; |
14
|
6
|
50
|
|
|
|
36
|
$ciph->init(@_) if @_; |
15
|
6
|
|
|
|
|
194
|
$ciph; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
0
|
0
|
|
sub keysize { } # stub |
19
|
0
|
|
|
0
|
0
|
0
|
sub blocksize { 16 } # 128 bits as required by AES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init { |
22
|
6
|
|
|
6
|
0
|
14
|
my $ciph = shift; |
23
|
6
|
|
|
|
|
14
|
my($key, $iv) = @_; |
24
|
|
|
|
|
|
|
|
25
|
6
|
|
|
|
|
25
|
$key = substr($key,0,$ciph->keysize); |
26
|
6
|
|
|
|
|
33
|
my $aes = Crypt::Cipher::AES->new($key); |
27
|
6
|
|
|
|
|
293
|
$ciph->{ctr} = Net::SSH::Perl::Cipher::CTR->new($aes, $iv); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub encrypt { |
31
|
3
|
|
|
3
|
1
|
3237
|
my($ciph, $text) = @_; |
32
|
3
|
|
|
|
|
14
|
return $ciph->{ctr}->encrypt($text); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub decrypt { |
36
|
3
|
|
|
3
|
1
|
23
|
my($ciph, $text) = @_; |
37
|
3
|
|
|
|
|
12
|
return $ciph->{ctr}->decrypt($text); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |