提交 a75831f9 编写于 作者: R Richard Levitte

Test the storeutl searching options

Reviewed-by: NMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2688)
上级 6ab6decc
......@@ -6,7 +6,7 @@
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
use File::Spec;
use File::Spec::Functions;
use File::Copy;
use MIME::Base64;
use OpenSSL::Test qw(:DEFAULT srctop_file srctop_dir bldtop_file data_file);
......@@ -75,7 +75,7 @@ my $n = (3 * scalar @noexist_files)
+ (scalar keys %generated_file_files)
+ (scalar @noexist_file_files)
+ 3
+ 4;
+ 11;
plan tests => $n;
......@@ -84,9 +84,7 @@ indir "store_$$" => sub {
{
skip "failed initialisation", $n unless init();
# test PEM_read_bio_PrivateKey
ok(run(app(["openssl", "rsa", "-in", "rsa-key-pkcs8-pbes2-sha256.pem",
"-passin", "pass:password"])));
my $rehash = init_rehash();
foreach (@noexist_files) {
my $file = srctop_file($_);
......@@ -153,6 +151,11 @@ indir "store_$$" => sub {
}
}
ok(!run(app(['openssl', 'storeutl',
'-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
srctop_file('test', 'testx509.pem')])),
"Checking that -subject can't be used with a single file");
ok(run(app(['openssl', 'storeutl', '-certs',
srctop_file('test', 'testx509.pem')])),
"Checking that -certs returns 1 object on a certificate file");
......@@ -166,6 +169,36 @@ indir "store_$$" => sub {
ok(run(app(['openssl', 'storeutl', '-crls',
srctop_file('test', 'testcrl.pem')])),
"Checking that -crls returns 1 object on a CRL file");
SKIP: {
skip "failed rehash initialisation", 6 unless $rehash;
# subject from testx509.pem:
# '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert'
# issuer from testcrl.pem:
# '/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority'
ok(run(app(['openssl', 'storeutl',
'-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
catdir(curdir(), 'rehash')])));
ok(run(app(['openssl', 'storeutl',
'-subject',
'/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority',
catdir(curdir(), 'rehash')])));
ok(run(app(['openssl', 'storeutl', '-certs',
'-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
catdir(curdir(), 'rehash')])));
ok(run(app(['openssl', 'storeutl', '-crls',
'-subject', '/C=AU/ST=QLD/CN=SSLeay\/rsa test cert',
catdir(curdir(), 'rehash')])));
ok(run(app(['openssl', 'storeutl', '-certs',
'-subject',
'/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority',
catdir(curdir(), 'rehash')])));
ok(run(app(['openssl', 'storeutl', '-crls',
'-subject',
'/C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority',
catdir(curdir(), 'rehash')])));
}
}
}, create => 1, cleanup => 1;
......@@ -364,6 +397,17 @@ sub init {
);
}
sub init_rehash {
return (
mkdir(catdir(curdir(), 'rehash'))
&& copy(srctop_file('test', 'testx509.pem'),
catdir(curdir(), 'rehash'))
&& copy(srctop_file('test', 'testcrl.pem'),
catdir(curdir(), 'rehash'))
&& run(app(['openssl', 'rehash', catdir(curdir(), 'rehash')]))
);
}
sub runall {
my ($function, @items) = @_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册