]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/90-test_store_cases.t
threads_pthread.c: change inline to ossl_inline
[thirdparty/openssl.git] / test / recipes / 90-test_store_cases.t
CommitLineData
1a27cc36
RL
1#! /usr/bin/env perl
2# Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License"). You may not use
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9# This collects specific use cases, and tests our handling
10
11use File::Spec::Functions;
12use File::Copy;
13use MIME::Base64;
14use OpenSSL::Test qw(:DEFAULT srctop_file srctop_dir bldtop_file bldtop_dir
15 data_file);
16use OpenSSL::Test::Utils;
17
18my $test_name = "test_store_cases";
19setup($test_name);
20
21plan tests => 2;
22
23my $stderr;
24
25# The case of the garbage PKCS#12 DER file where a passphrase was
26# prompted for. That should not have happened.
27$stderr = 'garbage-pkcs12.stderr.txt';
28ok(!run(app(['openssl', 'storeutl', '-passin', 'pass:invalidapass',
29 data_file('garbage-pkcs12.p12')],
30 stderr => $stderr)),
31 "checking that storeutl fails when given a garbage pkcs12 file");
32open DATA, $stderr;
33@match = grep /try_pkcs12:.*?:maybe wrong password$/, <DATA>;
34close DATA;
35ok(scalar @match > 0 ? 0 : 1,
36 "checking that storeutl didn't ask for a passphrase");