line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Comodo::DCV; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
149790
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
70
|
|
4
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
51
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use Digest::MD5 (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
61
|
|
7
|
2
|
|
|
2
|
|
970
|
use Digest::SHA (); |
|
2
|
|
|
|
|
5395
|
|
|
2
|
|
|
|
|
304
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.04; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=pod |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=encoding utf-8 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Comodo::DCV - DCV logic for COMODO SSL APIs |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Comodo::DCV; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#The following acts on a DER-formatted (i.e., binary) CSR only. |
24
|
|
|
|
|
|
|
my ($filename, $contents) = Comodo::DCV::get_filename_and_contents( $csr_der ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This module implements logic that is necessary for HTTP-based validation |
29
|
|
|
|
|
|
|
according to COMODO’s APIs for SSL certificate issuance, as documented |
30
|
|
|
|
|
|
|
at L. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
You can verify this module’s output by comparing it to that from |
33
|
|
|
|
|
|
|
L. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
B: This module works on DER-formatted (binary) CSRs. If you need to work with |
36
|
|
|
|
|
|
|
PEM-formatted (text/Base64) CSRs, first convert them via C or similar |
37
|
|
|
|
|
|
|
logic. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 BREAKING CHANGE: 20 JULY 2017 UPDATE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
As of 20 July 2017, Comodo will no longer look for SHA-1 hashes in DCV files; |
42
|
|
|
|
|
|
|
the new format is to use SHA-256 hashes. There is also a change of path for |
43
|
|
|
|
|
|
|
the DCV check, from F<$document_root/$MD5.txt> to |
44
|
|
|
|
|
|
|
F<$document_root/.well-known/pki-validation/$MD5.txt>. Any services that might |
45
|
|
|
|
|
|
|
interact with Comodo’s DCV thus need to stop using the old logic and start |
46
|
|
|
|
|
|
|
using the new. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Comodo has their new logic is in place as of 10 July 2017. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Note that this means you’ll need to ensure that |
51
|
|
|
|
|
|
|
F<$document_root/.well-known/pki-validation> exists. That’s something that |
52
|
|
|
|
|
|
|
this module will B do for you. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub get_filename_and_contents { |
57
|
3
|
|
|
3
|
0
|
1825
|
my ($csr_der) = @_; |
58
|
|
|
|
|
|
|
|
59
|
3
|
100
|
|
|
|
22
|
die 'Call in list context!' if !wantarray; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
10
|
my $md5_hash = Digest::MD5::md5_hex($csr_der); |
62
|
1
|
|
|
|
|
4
|
$md5_hash =~ tr; |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
5
|
my $filename = "$md5_hash.txt"; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
24
|
my $contents = join( |
67
|
|
|
|
|
|
|
$/, |
68
|
|
|
|
|
|
|
Digest::SHA::sha256_hex($csr_der), |
69
|
|
|
|
|
|
|
'comodoca.com', |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
6
|
return ( $filename, $contents ); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 BUGS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Please report to L. |
80
|
|
|
|
|
|
|
Thank you! |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Felipe Gasper |
85
|
|
|
|
|
|
|
CPAN ID: FELIPE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This program is free software; you can redistribute |
90
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The full text of the license can be found in the |
93
|
|
|
|
|
|
|
LICENSE file included with this module. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |