Lines Matching +full:csr +full:- +full:2 +full:l
2 # Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
52 "rsa-key-pkcs1.pem", "rsa-key-pkcs1.der",
53 "rsa-key-pkcs1-aes128.pem",
54 "rsa-key-pkcs8.pem", "rsa-key-pkcs8.der",
55 "rsa-key-pkcs8-pbes2-sha1.pem", "rsa-key-pkcs8-pbes2-sha1.der",
56 "rsa-key-pkcs8-pbes2-sha256.pem", "rsa-key-pkcs8-pbes2-sha256.der",
59 "rsa-key-pkcs8-pbes1-sha1-3des.pem", "rsa-key-pkcs8-pbes1-sha1-3des.der",
62 "rsa-key-sha1-3des-sha1.p12", "rsa-key-sha1-3des-sha256.p12",
63 "rsa-key-aes256-cbc-sha256.p12",
64 "rsa-key-md5-des-sha1.p12",
65 "rsa-key-aes256-cbc-md5-des-sha256.p12"
68 "rsa-key-pkcs8-pbes1-md5-des.pem", "rsa-key-pkcs8-pbes1-md5-des.der"
71 "dsa-key-pkcs1.pem", "dsa-key-pkcs1.der",
72 "dsa-key-pkcs1-aes128.pem",
73 "dsa-key-pkcs8.pem", "dsa-key-pkcs8.der",
74 "dsa-key-pkcs8-pbes2-sha1.pem", "dsa-key-pkcs8-pbes2-sha1.der",
76 push(@generated_files, "dsa-key-aes256-cbc-sha256.p12") if $use_dsa && $use_des;
78 "ec-key-pkcs1.pem", "ec-key-pkcs1.der",
79 "ec-key-pkcs1-aes128.pem",
80 "ec-key-pkcs8.pem", "ec-key-pkcs8.der",
81 "ec-key-pkcs8-pbes2-sha1.pem", "ec-key-pkcs8-pbes2-sha1.der",
83 push(@generated_files, "ec-key-aes256-cbc-sha256.p12") if $use_ecc && $use_des;
97 # The default is a built-in provider implementation.
103 my @prov_method = qw(-provider default);
104 push @prov_method, qw(-provider legacy) unless disabled('legacy');
106 push @methods, [qw(-engine loader_attic)]
112 + (2 * scalar @data_files)
122 !(disabled("engine") || disabled("dynamic-engine") || $^O =~ /^msys$/);
146 my @pubin = $_ =~ m|pub\.pem$| ? ("-pubin") : ();
148 ok(run(app(["openssl", "rsa", "-text", "-noout", @pubin,
149 "-engine", "ossltest", "-inform", "engine",
150 "-in", "ot:$file"])));
151 ok(run(app(["openssl", "rsa", "-text", "-noout", @pubin,
152 "-engine", "ossltest", "-inform", "engine",
153 "-in", "ot:$file_abs"])));
154 ok(run(app(["openssl", "rsa", "-text", "-noout", @pubin,
155 "-in", "${engine_scheme}ossltest:ot:$file"])));
156 ok(run(app(["openssl", "rsa", "-text", "-noout", @pubin,
157 "-in", "${engine_scheme}ossltest:ot:$file_abs"])));
173 ok(!run(app([@storeutl, "-noout", $file])));
174 ok(!run(app([@storeutl, "-noout", to_abs_file($file)])));
178 ok(!run(app([@storeutl, "-noout",
185 ok(run(app([@storeutl, "-noout", $file])));
186 ok(run(app([@storeutl, "-noout", to_abs_file($file)])));
191 ok(run(app([@storeutl, "-noout",
193 ok(run(app([@storeutl, "-noout",
195 ok(run(app([@storeutl, "-noout",
197 ok(!run(app([@storeutl, "-noout",
204 ok(run(app([@storeutl, "-noout", "-passin", "pass:password",
206 ok(run(app([@storeutl, "-noout", "-passin", "pass:password",
210 ok(run(app([@storeutl, "-noout", "-passin", "pass:password",
212 ok(run(app([@storeutl, "-noout", "-passin", "pass:password",
217 skip "file: tests disabled on MingW", 2 if $^O =~ /^msys$/;
219 ok(run(app([@storeutl, "-noout", "-passin",
221 ok(!run(app([@storeutl, "-noout", "-passin",
230 ok(run(app([@storeutl, "-noout", $_])));
238 ok(!run(app([@storeutl, "-noout", $_])));
244 ok(run(app([@storeutl, "-noout", $dir])));
245 ok(run(app([@storeutl, "-noout", to_abs_file($dir, 1)])));
250 ok(run(app([@storeutl, "-noout",
255 ok(!run(app([@storeutl, '-noout',
256 '-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
258 "Checking that -subject can't be used with a single file");
260 ok(run(app([@storeutl, '-certs', '-noout',
262 "Checking that -certs returns 1 object on a certificate file");
263 ok(run(app([@storeutl, '-certs', '-noout',
265 "Checking that -certs returns 0 objects on a CRL file");
267 ok(run(app([@storeutl, '-crls', '-noout',
269 "Checking that -crls returns 0 objects on a certificate file");
270 ok(run(app([@storeutl, '-crls', '-noout',
272 "Checking that -crls returns 1 object on a CRL file");
281 ok(run(app([@storeutl, '-noout',
282 '-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
284 ok(run(app([@storeutl, '-noout',
285 '-subject',
288 ok(run(app([@storeutl, '-noout', '-certs',
289 '-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
291 ok(run(app([@storeutl, '-noout', '-crls',
292 '-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
294 ok(run(app([@storeutl, '-noout', '-certs',
295 '-subject',
298 ok(run(app([@storeutl, '-noout', '-crls',
299 '-subject',
308 my $cnf = srctop_file('test', 'ca-and-certs.cnf');
309 my $cakey = srctop_file('test', 'certs', 'ca-key.pem');
310 my @std_args = qw(-provider default);
311 push @std_args, qw(-provider legacy)
314 # rsa-key-pkcs1.pem
316 "-in", data_file("rsa-key-2432.pem"),
317 "-out", "rsa-key-pkcs1.pem"]))
318 # rsa-key-pkcs1-aes128.pem
320 "-passout", "pass:password", "-aes128",
321 "-in", "rsa-key-pkcs1.pem",
322 "-out", "rsa-key-pkcs1-aes128.pem"]))
323 # dsa-key-pkcs1.pem
326 "-out", "dsa-key-pkcs1.pem",
328 # dsa-key-pkcs1-aes128.pem
331 "-passout", "pass:password", "-aes128",
332 "-in", "dsa-key-pkcs1.pem",
333 "-out", "dsa-key-pkcs1-aes128.pem"])))
334 # ec-key-pkcs1.pem (one might think that 'genec' would be practical)
337 "-genkey",
338 "-name", "prime256v1",
339 "-out", "ec-key-pkcs1.pem"])))
340 # ec-key-pkcs1-aes128.pem
343 "-passout", "pass:password", "-aes128",
344 "-in", "ec-key-pkcs1.pem",
345 "-out", "ec-key-pkcs1-aes128.pem"])))
346 # *-key-pkcs8.pem
350 =~ s/-key-pkcs8\.pem$/-key-pkcs1.pem/i;
352 "-topk8", "-nocrypt",
353 "-in", $srcfile, "-out", $dstfile]));
354 }, grep(/-key-pkcs8\.pem$/, @generated_files))
355 # *-key-pkcs8-pbes1-sha1-3des.pem
359 =~ s/-key-pkcs8-pbes1-sha1-3des\.pem$
360 /-key-pkcs8.pem/ix;
362 "-topk8",
363 "-passout", "pass:password",
364 "-v1", "pbeWithSHA1And3-KeyTripleDES-CBC",
365 "-in", $srcfile, "-out", $dstfile]));
366 }, grep(/-key-pkcs8-pbes1-sha1-3des\.pem$/, @generated_files))
367 # *-key-pkcs8-pbes1-md5-des.pem
371 =~ s/-key-pkcs8-pbes1-md5-des\.pem$
372 /-key-pkcs8.pem/ix;
374 "-topk8",
375 "-passout", "pass:password",
376 "-v1", "pbeWithSHA1And3-KeyTripleDES-CBC",
377 "-in", $srcfile, "-out", $dstfile]));
378 }, grep(/-key-pkcs8-pbes1-md5-des\.pem$/, @generated_files))
379 # *-key-pkcs8-pbes2-sha1.pem
383 =~ s/-key-pkcs8-pbes2-sha1\.pem$
384 /-key-pkcs8.pem/ix;
386 "-topk8",
387 "-passout", "pass:password",
388 "-v2", "aes256", "-v2prf", "hmacWithSHA1",
389 "-in", $srcfile, "-out", $dstfile]));
390 }, grep(/-key-pkcs8-pbes2-sha1\.pem$/, @generated_files))
391 # *-key-pkcs8-pbes2-sha1.pem
395 =~ s/-key-pkcs8-pbes2-sha256\.pem$
396 /-key-pkcs8.pem/ix;
398 "-topk8",
399 "-passout", "pass:password",
400 "-v2", "aes256", "-v2prf", "hmacWithSHA256",
401 "-in", $srcfile, "-out", $dstfile]));
402 }, grep(/-key-pkcs8-pbes2-sha256\.pem$/, @generated_files))
403 # *-cert.pem (intermediary for the .p12 inits)
404 && run(app(["openssl", "req", "-x509", @std_args,
405 "-config", $cnf, "-noenc",
406 "-key", $cakey, "-out", "cacert.pem"]))
409 (my $dstfile = $srckey) =~ s|-key-pkcs8\.|-cert.|;
410 (my $csr = $dstfile) =~ s|\.pem|.csr|;
412 (run(app(["openssl", "req", "-new", @std_args,
413 "-config", $cnf, "-section", "userreq",
414 "-key", $srckey, "-out", $csr]))
417 "-days", "3650",
418 "-CA", "cacert.pem",
419 "-CAkey", $cakey,
420 "-set_serial", time(), "-req",
421 "-in", $csr, "-out", $dstfile])));
422 }, grep(/-key-pkcs8\.pem$/, @generated_files))
428 $dstfile =~ m{^(.*)-key-(?|
431 ([^-]*-[^-]*)- # key & cert PBE
432 ([^-]*) # MACalg
435 ([^-]*-[^-]*)- # cert PBE
436 ([^-]*-[^-]*)- # key PBE
437 ([^-]*) # MACalg
442 my $srckey = "$type-key-pkcs8.pem";
443 my $srccert = "$type-cert.pem";
446 "sha1-3des" => "pbeWithSHA1And3-KeyTripleDES-CBC",
447 "md5-des" => "pbeWithMD5AndDES-CBC",
448 "aes256-cbc" => "AES-256-CBC",
470 "-inkey", $srckey,
471 "-in", $srccert, "-passout", "pass:password",
472 "-chain", "-CAfile", "cacert.pem",
473 "-export", "-macalg", $macalg,
474 "-certpbe", $certpbe, "-keypbe", $keypbe,
475 "-out", $dstfile]));
481 if (! -f $srcfile) {
488 my $l;
489 while (($l = <$infh>) !~ /^-----BEGIN\s/
490 || $l =~ /^-----BEGIN.*PARAMETERS-----/) {
493 while (($l = <$infh>) !~ /^-----END\s/) {
494 $l =~ s|\R$||;
495 $b64 .= $l unless $l =~ /:/;
499 unless (length($b64) / 4 * 3 - length($der) < 3) {
541 return 0 unless $function->($_);
555 ($vol, $dir, $file) = File::Spec->splitpath($file, $isdir // 0);
558 $dir = join('/', File::Spec->splitdir($dir));
596 return File::Spec->rel2abs($file);