line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::KDBX::Key::ChallengeResponse; |
2
|
|
|
|
|
|
|
# ABSTRACT: A challenge-response key |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1105
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
66
|
|
5
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
40
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
8
|
use File::KDBX::Error; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
101
|
|
8
|
2
|
|
|
2
|
|
10
|
use File::KDBX::Util qw(:class); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
253
|
|
9
|
2
|
|
|
2
|
|
13
|
use namespace::clean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'File::KDBX::Key'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.904'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub init { |
16
|
18
|
|
|
18
|
1
|
43
|
my $self = shift; |
17
|
18
|
50
|
|
|
|
57
|
my $primitive = shift or throw 'Missing key primitive'; |
18
|
|
|
|
|
|
|
|
19
|
18
|
|
|
|
|
50
|
$self->{responder} = $primitive; |
20
|
|
|
|
|
|
|
|
21
|
18
|
|
|
|
|
49
|
return $self->hide; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub raw_key { |
26
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
27
|
0
|
0
|
|
|
|
0
|
if (@_) { |
28
|
0
|
|
0
|
|
|
0
|
my $challenge = shift // ''; |
29
|
|
|
|
|
|
|
# Don't challenge if we already have the response. |
30
|
0
|
0
|
0
|
|
|
0
|
return $self->SUPER::raw_key if $challenge eq ($self->{challenge} // ''); |
31
|
0
|
|
|
|
|
0
|
$self->_set_raw_key($self->challenge($challenge, @_)); |
32
|
0
|
|
|
|
|
0
|
$self->{challenge} = $challenge; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
0
|
$self->SUPER::raw_key; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub challenge { |
39
|
18
|
|
|
18
|
1
|
41
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
18
|
50
|
|
|
|
56
|
my $responder = $self->{responder} or throw 'Cannot issue challenge without a responder'; |
42
|
18
|
|
|
|
|
80
|
return $responder->(@_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |