| 1 | package Crypt::Perl::X509::Extension::ct_precert_scts; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | =encoding utf-8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Crypt::Perl::X509::Extension::ct_precert_scts - X.509 ct_precert_scts extension | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | my $extn = Crypt::Perl::X509::Extension::ct_precert_scts->new( | ||
| 15 | { | ||
| 16 | log_id => .., | ||
| 17 | timestamp => .., | ||
| 18 | extensions => [ .. ], | ||
| 19 | signature_algorithm => '..', | ||
| 20 | }, | ||
| 21 | # .. | ||
| 22 | ); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | Instances of this class represent a C<ct_precert_scts> extension | ||
| 27 | of an X.509 (SSL) certificate. | ||
| 28 | |||
| 29 | You probably don’t need to | ||
| 30 | instantiate this class directly; see L<Crypt::Perl::PKCS10> | ||
| 31 | and L<Crypt::Perl::X509> for the way this module is meant to be used. | ||
| 32 | |||
| 33 | =head1 SEE ALSO | ||
| 34 | |||
| 35 | =over | ||
| 36 | |||
| 37 | =item * L<https://tools.ietf.org/html/rfc6962#section-3.3> | ||
| 38 | |||
| 39 | =item * L<https://letsencrypt.org/2018/04/04/sct-encoding.html> | ||
| 40 | |||
| 41 | =back | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | 1 | use parent qw( | |
| 46 | Crypt::Perl::X509::Extension | ||
| 47 | 1 | ▶ | ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | |||
| 49 | 1 | ▶ | use Crypt::Perl::X509::SCT (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 50 | |||
| 51 | 1 | ▶ | use constant OID => '1.3.6.1.4.1.11129.2.4.2'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 52 | |||
| 53 | 1 | ▶ | use constant ASN1 => <<END; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 54 | ct_precert_scts ::= SignedCertificateTimestampList | ||
| 55 | |||
| 56 | SignedCertificateTimestampList ::= OCTET STRING | ||
| 57 | END | ||
| 58 | |||
| 59 | sub new { | ||
| 60 | 6 | ▶ | my ($class, @sct_hrs) = @_; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 61 | |||
| 62 | 6 | return bless \@sct_hrs, $class; | |
| 63 | } | ||
| 64 | |||
| 65 | sub _encode_params { | ||
| 66 | 6 | ▶ | my ($self) = @_; |
|
Subroutine
_encode_params: called CC=2 SCAR=6.9
| |||
| 67 | |||
| 68 | 6 | my @scts = map { Crypt::Perl::X509::SCT::encode(%$_) } @$self; | |
| 69 | |||
| 70 | # Prefix with length. | ||
| 71 | 6 | _tls_length_encode($_) for @scts; | |
| 72 | |||
| 73 | 6 | my $list = join( q<>, @scts ); | |
| 74 | |||
| 75 | 6 | _tls_length_encode($list); | |
| 76 | } | ||
| 77 | |||
| 78 | sub _tls_length_encode { | ||
| 79 | 18 | ▶ | substr( $_[0], 0, 0, pack('n', length $_[0]) ); |
|
Subroutine
_tls_length_encode: called CC=1 SCAR=0.0
| |||
| 80 | |||
| 81 | 18 | return $_[0]; | |
| 82 | } | ||
| 83 | |||
| 84 | 1 | 1; | |