File: PKCS12.pm

package info (click to toggle)
libcrypt-openssl-pkcs12-perl 1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 240 kB
  • sloc: perl: 2,200; makefile: 6
file content (126 lines) | stat: -rw-r--r-- 2,187 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package Crypt::OpenSSL::PKCS12;

use strict;
use Exporter;

our $VERSION = '1.3';
our @ISA = qw(Exporter);

our @EXPORT_OK = qw(NOKEYS NOCERTS INFO CLCERTS CACERTS);

use XSLoader;

XSLoader::load 'Crypt::OpenSSL::PKCS12', $VERSION;

END {
  __PACKAGE__->__PKCS12_cleanup();
}

1;

__END__

=head1 NAME

Crypt::OpenSSL::PKCS12 - Perl extension to OpenSSL's PKCS12 API.

=head1 SYNOPSIS

  use Crypt::OpenSSL::PKCS12;

  my $pass   = "your password";
  my $pkcs12 = Crypt::OpenSSL::PKCS12->new_from_file('cert.p12');

  print $pkcs12->certificate($pass);
  print $pkcs12->private_key($pass);

  if ($pkcs12->mac_ok($pass)) {
  ....

  $pkcs12->create('test-cert.pem', 'test-key.pem', $pass, 'out.p12', "friendly name");

=head1 ABSTRACT

  Crypt::OpenSSL::PKCS12 - Perl extension to OpenSSL's PKCS12 API.

=head1 DESCRIPTION

  This implements a small bit of OpenSSL's PKCS12 API.

=head1 FUNCTIONS

=over 4

=item * new( )

=item * new_from_string( $string )

=item * new_from_file( $filename )

Create a new Crypt::OpenSSL::PKCS12 instance.

=item * certificate( [$pass] )

Get the Base64 representation of the certificate.

=item * private_key( [$pass] )

Get the Base64 representation of the private key.

=item * as_string( [$pass] )

Get the binary represenation as a string.

=item * mac_ok( [$pass] )

Verifiy the certificates Message Authentication Code

=item * changepass( $old, $new )

Change a certificate's password.

=item * create( $cert, $key, $pass, $output_file, $friendly_name )

Create a new PKCS12 certificate. $cert & $key may either be strings or filenames.

$friendly_name is optional.

=back

=head1 EXPORT

None by default.

On request:

=over 4

=item * NOKEYS

=item * NOCERTS

=item * INFO

=item * CLCERTS

=item * CACERTS

=back

=head1 SEE ALSO

OpenSSL(1), Crypt::OpenSSL::X509, Crypt::OpenSSL::RSA, Crypt::OpenSSL::Bignum

=head1 AUTHOR

Dan Sully, E<lt>daniel@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2004-2018 by Dan Sully

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.

=cut