File Coverage

lib/Crypt/Perl/PKCS10/Attribute/challengePassword.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package Crypt::Perl::PKCS10::Attribute::challengePassword;
2              
3             =encoding utf-8
4              
5             =head1 NAME
6              
7             Crypt::Perl::PKCS10::Attribute::challengePassword
8              
9             =head1 SYNOPSIS
10              
11             my $chpw = Crypt::Perl::PKCS10::Attribute::challengePassword->new($passwd);
12              
13             =head1 SECURITY
14              
15             This attribute stores a phrase B in the CSR. Don’t put
16             anything in here that you consider sensitive!
17              
18             It’s likely that you don’t need this attribute.
19             Check with your Certificate Authority to find out for sure sure if
20             you need to include this in your CSR.
21              
22             =head1 DESCRIPTION
23              
24             Instances of this class represent a C attribute of a
25             PKCS #10 Certificate Signing Request (CSR).
26              
27             You probably don’t need to
28             instantiate this class directly; instead, you can instantiate it
29             implicitly by listing out arguments to
30             L’s constructor. See that module’s
31             L for an example.
32              
33             =cut
34              
35 1     1   567 use strict;
  1         3  
  1         25  
36 1     1   4 use warnings;
  1         1  
  1         36  
37              
38 1     1   6 use parent qw( Crypt::Perl::PKCS10::Attribute );
  1         2  
  1         14  
39              
40 1     1   35 use constant OID => '1.2.840.113549.1.9.7';
  1         8  
  1         64  
41              
42 1     1   6 use constant ASN1 => <
  1         2  
  1         112  
43             challengePassword ::= CHOICE {
44             password UTF8String
45             }
46             END
47              
48             sub new {
49 9     9 0 47 my ($class, $passwd) = @_;
50              
51 9         100 return bless \$passwd, $class;
52             }
53              
54             sub _encode_params {
55 9     9   24 my ($self) = @_;
56              
57             return {
58 9         59 password => "$$self",
59             };
60             }
61              
62             1;