File Coverage

blib/lib/Comodo/DCV.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             package Comodo::DCV;
2              
3 2     2   40394 use strict;
  2         3  
  2         57  
4 2     2   8 use warnings;
  2         2  
  2         58  
5              
6 2     2   9 use Digest::MD5 ();
  2         10  
  2         29  
7 2     2   1119 use Digest::SHA ();
  2         4983  
  2         282  
8              
9             our $VERSION = 0.02;
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             =cut
40              
41             sub get_filename_and_contents {
42 3     3 0 1268 my ($csr_der) = @_;
43              
44 3 100       18 die 'Call in list context!' if !wantarray;
45              
46 1         10 my $md5_hash = Digest::MD5::md5_hex($csr_der) =~ trr;
47 1         3 my $filename = "$md5_hash.txt";
48              
49 1         24 my $contents = join(
50             $/,
51             Digest::SHA::sha1_hex($csr_der),
52             'comodoca.com',
53             );
54              
55 1         2 return ( $filename, $contents );
56             }
57              
58             =pod
59              
60             =head1 BUGS
61              
62             Please report to L.
63             Thank you!
64              
65             =head1 AUTHOR
66              
67             Felipe Gasper
68             CPAN ID: FELIPE
69              
70             =head1 COPYRIGHT
71              
72             This program is free software; you can redistribute
73             it and/or modify it under the same terms as Perl itself.
74              
75             The full text of the license can be found in the
76             LICENSE file included with this module.
77              
78             =cut
79              
80             1;