2 # Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (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
12 use OpenSSL::Test qw/:DEFAULT srctop_file/;
13 use OpenSSL::Test::Utils;
19 plan skip_all => "The PKCS12 command line utility is not supported by this OpenSSL build"
22 my $pass = "σύνθημα γνώρισμα";
25 if (eval { require Win32::API; 1; }) {
26 # Trouble is that Win32 perl uses CreateProcessA, which
27 # makes it problematic to pass non-ASCII arguments, from perl[!]
28 # that is. This is because CreateProcessA is just a wrapper for
29 # CreateProcessW and will call MultiByteToWideChar and use
30 # system default locale. Since we attempt Greek pass-phrase
31 # conversion can be done only with Greek locale.
33 Win32::API->Import("kernel32","UINT GetSystemDefaultLCID()");
34 if (GetSystemDefaultLCID() != 0x408) {
35 plan skip_all => "Non-Greek system locale";
37 # Ensure correct code page so that VERBOSE output is right.
38 Win32::API->Import("kernel32","UINT GetConsoleOutputCP()");
39 Win32::API->Import("kernel32","BOOL SetConsoleOutputCP(UINT cp)");
40 $savedcp = GetConsoleOutputCP();
41 SetConsoleOutputCP(1253);
42 $pass = Encode::encode("cp1253",Encode::decode("utf-8",$pass));
45 # Running MinGW tests transparenly under Wine apparently requires
48 foreach(`locale -a`) {
50 if ($_ =~ m/^C\.UTF\-?8/i) {
56 $ENV{OPENSSL_WIN32_UTF8}=1;
60 # just see that we can read shibboleth.pfx protected with $pass
61 ok(run(app(["openssl", "pkcs12", "-noout",
62 "-password", "pass:$pass",
63 "-in", srctop_file("test", "shibboleth.pfx")])),
66 SetConsoleOutputCP($savedcp) if (defined($savedcp));