Skip to content

Commit bfe1d0e

Browse files
waterkiptimlegge
authored andcommitted
Update POD
Signed-off-by: Wesley Schwengle <[email protected]>
1 parent 16c240e commit bfe1d0e

File tree

2 files changed

+64
-42
lines changed

2 files changed

+64
-42
lines changed

Diff for: Verify.pm

+51-34
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,30 @@ Crypt::OpenSSL::Verify - OpenSSL Verify certificate verification in XS.
103103
use Crypt::OpenSSL::X509;
104104
105105
my $ca = Crypt::OpenSSL::Verify->new(
106-
CAfile => 't/cacert.pem',
107-
CApath => '/etc/ssl/certs', # Optional
108-
noCAfile => 1, # Optional
109-
noCApath => 0 # Optional
110-
);
111-
112-
OR
106+
't/cacert.pem', # or undef
107+
{
108+
CApath => '/etc/ssl/certs', # Optional
109+
noCAfile => 1, # Optional
110+
noCApath => 0 # Optional
111+
}
112+
);
113113
114114
# Backward compatible with Crypt::OpenSSL:VerifyX509
115115
my $ca = Crypt::OpenSSL::Verify->new('t/cacert.pem');
116116
117-
AND
117+
# Using the defaults of your OS:
118+
my $ca = Crypt::OpenSSL::Verify->new();
119+
120+
# and later on..
118121
119122
my $cert = Crypt::OpenSSL::X509->new(...);
120123
$ca->verify($cert);
121124
125+
126+
The object created is similar to running the following command with the
127+
C<openssl verify> command line tool: C<< openssl verify [ -CApath /path/to/certs ]
128+
[ -noCApath ] [ -noCAfile ] [ -CAfile /path/to/file ] cert.pem >>
129+
122130
=head1 DESCRIPTION
123131
124132
Given a CA certificate and another untrusted certificate, will show
@@ -134,30 +142,28 @@ need to verify that the signing certificate is valid.
134142
135143
Constructor. Returns an OpenSSL Verify instance, set up with the given CA.
136144
137-
Arguments:
138-
139-
* CAfile => $cafile_path - path to a file containing the CA certificate
140-
* CApath => $ca_path - path to a directory containg hashed CA Certificates
141-
* noCAfile => 0 or 1 - Default CAfile should not be loaded if TRUE
142-
* noCApath => 0 or 1 - Default CApath should not be loaded if TRUE
143-
* strict_certs => 0 or 1 - Do not override any OpenSSL verify errors
145+
my $ca = Crypt::OpenSSL::Verify->new(
146+
't/cacert.pem', # or undef
147+
{
148+
# Path to a directory containg hashed CA Certificates
149+
CApath => $ca_path,
144150
145-
(
146-
CAfile => $cafile_path
147-
CApath => '/etc/ssl/certs', # Optional
148-
noCAfile => 1, # Optional
149-
noCApath => 0, # Optional
150-
strict_certs => 1 # Default (Optional)
151-
);
151+
# Default CAfile should not be loaded if TRUE, defaults to FALSE
152+
noCAfile => 0,
152153
153-
=head2 new('t/cacert.pem');
154+
# Default CApath should not be loaded if TRUE, defaults to FALSE
155+
noCApath => 0,
154156
155-
Constructor. Returns an OpenSSL Verify instance, set up with the given CA.
156-
Backward compatible with Crypt::OpenSSL:VerifyX509
157+
# Do not override any OpenSSL verify errors if FALSE, defaults to TRUE
158+
strict_certs => 1,
159+
}
160+
);
157161
158-
Arguments:
162+
# Backward compatible with Crypt::OpenSSL:VerifyX509
163+
my $ca = Crypt::OpenSSL::Verify->new('t/cacert.pem', {strict_certs => 0 });
159164
160-
* $cafile_path - path to a file containing the CA certificate
165+
# Using the defaults of your OS:
166+
my $ca = Crypt::OpenSSL::Verify->new();
161167
162168
=head2 new_from_x509($catext)
163169
@@ -211,24 +217,35 @@ Arguements:
211217
212218
=head1 AUTHOR
213219
214-
Timothy Legge <[email protected]>
215-
Wesley Schwengle <waterkip>
220+
=over
221+
222+
=item Timothy Legge <[email protected]>
223+
224+
=item Wesley Schwengle <[email protected]>
225+
226+
=back
216227
217228
=head1 COPYRIGHT
218229
219230
The following copyright notice applies to all the files provided in
220231
this distribution, including binary files, unless explicitly noted
221232
otherwise.
222233
223-
Copyright 2020 Timothy Legge
224-
Copyright 2020 Wesley Schwengle
234+
=over
235+
236+
=item Copyright 2020 Timothy Legge
237+
238+
=item Copyright 2020 Wesley Schwengle
239+
240+
=back
225241
226242
Based on the Original Crypt::OpenSSL::VerifyX509 by
227243
228-
Copyright 2010 Chris Andrews <[email protected]>
244+
=over
245+
246+
=item Copyright 2010 Chris Andrews <[email protected]>
229247
230-
Most of the current module is based on the OpenSSL verify.c app and is
231-
therefore under Copyright 1999-2020, OpenSSL Software Foundation.
248+
=back
232249
233250
=head1 LICENCE
234251

Diff for: Verify.xs

+13-8
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,16 @@ and returns it to OpenSSL
101101

102102
=over
103103

104-
=item ok
105-
* ok - the result of the certificate verification in OpenSSL
106-
ok = 1, !ok = 0
104+
=item * ok
105+
106+
The result of the certificate verification in OpenSSL ok = 1, !ok =
107+
0
108+
109+
=item * ctx
110+
111+
Pointer to the X509_Store_CTX that OpenSSL includes the error codes
112+
in
107113

108-
=item ctx
109-
* ctx - Pointer to the X509_Store_CTX that OpenSSL includes the
110-
error codes in
111114
=back
112115

113116
=cut
@@ -224,7 +227,7 @@ void register_verify_cb(fn)
224227
else
225228
SvSetSV(callback, fn);
226229

227-
=head new
230+
=head1 new
228231

229232
Constructs the object ready to verify the certificates.
230233
It also sets the callback function.
@@ -405,7 +408,9 @@ int ctx_error_code(ctx)
405408
The actual verify function that calls OpenSSL to verify the x509 Cert that
406409
has been passed in as a parameter against the store that was setup in _new()
407410

408-
=over Parameters
411+
=head3 Parameters
412+
413+
=over
409414

410415
=item self - self object
411416

0 commit comments

Comments
 (0)