@@ -103,22 +103,30 @@ Crypt::OpenSSL::Verify - OpenSSL Verify certificate verification in XS.
103
103
use Crypt::OpenSSL::X509;
104
104
105
105
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
+ );
113
113
114
114
# Backward compatible with Crypt::OpenSSL:VerifyX509
115
115
my $ca = Crypt::OpenSSL::Verify->new('t/cacert.pem');
116
116
117
- AND
117
+ # Using the defaults of your OS:
118
+ my $ca = Crypt::OpenSSL::Verify->new();
119
+
120
+ # and later on..
118
121
119
122
my $cert = Crypt::OpenSSL::X509->new(...);
120
123
$ca->verify($cert);
121
124
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
+
122
130
=head1 DESCRIPTION
123
131
124
132
Given a CA certificate and another untrusted certificate, will show
@@ -134,30 +142,28 @@ need to verify that the signing certificate is valid.
134
142
135
143
Constructor. Returns an OpenSSL Verify instance, set up with the given CA.
136
144
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,
144
150
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,
152
153
153
- =head2 new('t/cacert.pem');
154
+ # Default CApath should not be loaded if TRUE, defaults to FALSE
155
+ noCApath => 0,
154
156
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
+ );
157
161
158
- Arguments:
162
+ # Backward compatible with Crypt::OpenSSL:VerifyX509
163
+ my $ca = Crypt::OpenSSL::Verify->new('t/cacert.pem', {strict_certs => 0 });
159
164
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();
161
167
162
168
=head2 new_from_x509($catext)
163
169
@@ -211,24 +217,35 @@ Arguements:
211
217
212
218
=head1 AUTHOR
213
219
214
-
215
- Wesley Schwengle <waterkip>
220
+ =over
221
+
222
+ =item Timothy Legge <[email protected] >
223
+
224
+ =item Wesley Schwengle <[email protected] >
225
+
226
+ =back
216
227
217
228
=head1 COPYRIGHT
218
229
219
230
The following copyright notice applies to all the files provided in
220
231
this distribution, including binary files, unless explicitly noted
221
232
otherwise.
222
233
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
225
241
226
242
Based on the Original Crypt::OpenSSL::VerifyX509 by
227
243
228
- Copyright 2010 Chris Andrews <[email protected] >
244
+ =over
245
+
246
+ =item Copyright 2010 Chris Andrews <[email protected] >
229
247
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
232
249
233
250
=head1 LICENCE
234
251
0 commit comments