line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::KDBX::Key::ChallengeResponse; |
2
|
|
|
|
|
|
|
# ABSTRACT: A challenge-response key |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1234
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
79
|
|
5
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use File::KDBX::Error; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
142
|
|
8
|
2
|
|
|
2
|
|
13
|
use File::KDBX::Util qw(:class); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
233
|
|
9
|
2
|
|
|
2
|
|
13
|
use namespace::clean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'File::KDBX::Key'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.905'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub init { |
16
|
18
|
|
|
18
|
1
|
31
|
my $self = shift; |
17
|
18
|
50
|
|
|
|
37
|
my $primitive = shift or throw 'Missing key primitive'; |
18
|
|
|
|
|
|
|
|
19
|
18
|
|
|
|
|
48
|
$self->{responder} = $primitive; |
20
|
|
|
|
|
|
|
|
21
|
18
|
|
|
|
|
38
|
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
|
27
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
18
|
50
|
|
|
|
37
|
my $responder = $self->{responder} or throw 'Cannot issue challenge without a responder'; |
42
|
18
|
|
|
|
|
41
|
return $responder->(@_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |