Lines Matching +full:msb +full:- +full:-
2 # Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
29 my $out_msb = "out-cyrillic.msb";
30 my $out_utf8 = "out-cyrillic.utf8";
33 my $msb = srctop_file(@certs, "cyrillic.msb");
36 ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out_msb,
37 "-nameopt", "esc_msb"])));
38 is(cmp_text($out_msb, $msb),
39 0, 'Comparing esc_msb output with cyrillic.msb');
40 ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out_utf8,
41 "-nameopt", "utf8"])));
47 skip "Platform doesn't support command line UTF-8", 1 if $^O =~ /^(VMS|msys)$/;
52 ok(run(app(["openssl", "x509", "-text", "-in", $p12, "-out", $out_pem,
53 "-passin", "pass:$p12pass"])));
57 ok(!run(app(["openssl", "x509", "-in", $pem, "-inform", "DER",
58 "-out", $der, "-outform", "DER"])),
59 "Checking failure of mismatching -inform DER");
60 ok(run(app(["openssl", "x509", "-in", $pem, "-inform", "PEM",
61 "-out", $der, "-outform", "DER"])),
63 ok(!run(app(["openssl", "x509", "-in", $der, "-inform", "PEM",
64 "-out", $der2, "-outform", "DER"])),
65 "Checking failure of mismatching -inform PEM");
67 # producing and checking self-issued (but not self-signed) cert
68 my $subj = "/CN=CA"; # using same DN as in issuer of ee-cert.pem
70 my $pkey = srctop_file(@certs, "ca-key.pem"); # issuer private key
71 my $pubkey = "ca-pubkey.pem"; # the corresponding issuer public key
72 # use any (different) key for signing our self-issued cert:
74 my $selfout = "self-issued.out";
75 my $testcert = srctop_file(@certs, "ee-cert.pem");
76 ok(run(app(["openssl", "pkey", "-in", $pkey, "-pubout", "-out", $pubkey]))
77 && run(app(["openssl", "x509", "-new", "-force_pubkey", $pubkey,
78 "-subj", $subj, "-extfile", $extfile,
79 "-signkey", $signkey, "-out", $selfout]))
80 && run(app(["openssl", "verify", "-no_check_time",
81 "-trusted", $selfout, "-partial_chain", $testcert])));
85 subtest 'x509 -- x.509 v1 certificate' => sub {
86 tconversion( -type => 'x509', -prefix => 'x509v1',
87 -in => srctop_file("test", "testx509.pem") );
89 subtest 'x509 -- first x.509 v3 certificate' => sub {
90 tconversion( -type => 'x509', -prefix => 'x509v3-1',
91 -in => srctop_file("test", "v3-cert1.pem") );
93 subtest 'x509 -- second x.509 v3 certificate' => sub {
94 tconversion( -type => 'x509', -prefix => 'x509v3-2',
95 -in => srctop_file("test", "v3-cert2.pem") );
98 subtest 'x509 -- pathlen' => sub {
102 cert_contains(srctop_file(@certs, "fake-gp.pem"),
103 "2.16.528.1.1003.1.3.5.5.2-1-0000006666-Z-12345678-01.015-12345678",
104 1, 'x500 -- subjectAltName');
109 my @args = qw(openssl x509 -in);
112 my $res = grep(/-text/, @opts) ? run(app([@args], stdout => $tmpfile))
126 # 3 tests for non-existence of spurious OSSL_STORE ASN.1 parse error output.
128 ok(test_errors("Bad output format", "root-cert.pem", '-outform', 'http'),
129 "load root-cert errors");
130 ok(test_errors("RC2-40-CBC", "v3-certs-RC2.p12", '-passin', 'pass:v3-certs'),
131 "load v3-certs-RC2 no asn1 errors"); # error msg should mention "RC2-40-CBC"
135 ok(test_errors("Unable to load Public Key", "sm2.pem", '-text'),
139 # 3 tests for -dateopts formats
140 ok(run(app(["openssl", "x509", "-noout", "-dates", "-dateopt", "rfc_822",
141 "-in", srctop_file("test/certs", "ca-cert.pem")])),
142 "Run with rfc_8222 -dateopt format");
143 ok(run(app(["openssl", "x509", "-noout", "-dates", "-dateopt", "iso_8601",
144 "-in", srctop_file("test/certs", "ca-cert.pem")])),
145 "Run with iso_8601 -dateopt format");
146 ok(!run(app(["openssl", "x509", "-noout", "-dates", "-dateopt", "invalid_format",
147 "-in", srctop_file("test/certs", "ca-cert.pem")])),
148 "Run with invalid -dateopt format");
150 # extracts issuer from a -text formatted-output
165 my $a_key = "a-key.pem";
166 my $a_cert = "a-cert.pem";
167 my $a2_cert = "a2-cert.pem";
168 my $ca_key = "ca-key.pem";
169 my $ca_cert = "ca-cert.pem";
173 ok(run(app(["openssl", "req", "-x509", "-newkey", "rsa:2048",
174 "-config", $cnf,
175 "-keyout", $a_key, "-out", $a_cert, "-days", "365",
176 "-nodes", "-subj", "/CN=test.example.com"])));
177 # Create cert CA - note key size
178 ok(run(app(["openssl", "req", "-x509", "-newkey", "rsa:4096",
179 "-config", $cnf,
180 "-keyout", $ca_key, "-out", $ca_cert, "-days", "3650",
181 "-nodes", "-subj", "/CN=ca.example.com"])));
183 ok(run(app(["openssl", "x509", "-in", $a_cert, "-CA", $ca_cert,
184 "-CAkey", $ca_key, "-set_serial", "1234567890",
185 "-preserve_dates", "-sha256", "-text", "-out", $a2_cert])));
189 my $in_csr = srctop_file('test', 'certs', 'x509-check.csr');
190 my $in_key = srctop_file('test', 'certs', 'x509-check-key.pem');
191 my $invextfile = srctop_file('test', 'invalid-x509.cnf');
193 ok(!run(app(["openssl", "x509", "-req", "-in", $in_csr, "-signkey", $in_key,
194 "-out", "/dev/null", "-days", "3650" , "-extensions", "ext",
195 "-extfile", $invextfile])));
198 my $b_key = "b-key.pem";
199 my $b_csr = "b-cert.csr";
200 my $b_cert = "b-cert.pem";
202 ok(run(app(["openssl", "req", "-new", "-newkey", "rsa:4096",
203 "-keyout", $b_key, "-out", $b_csr, "-nodes",
204 "-config", $cnf,
205 "-subj", "/CN=b.example.com"])));
206 # Sign it - position of "-text" matters!
207 ok(run(app(["openssl", "x509", "-req", "-text", "-CAcreateserial",
208 "-CA", $ca_cert, "-CAkey", $ca_key,
209 "-in", $b_csr, "-out", $b_cert])));