2016-04-22 19:21:51 +08:00
|
|
|
#! /usr/bin/env perl
|
2020-04-23 20:55:52 +08:00
|
|
|
# Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2016-04-22 19:21:51 +08:00
|
|
|
#
|
2018-12-06 20:05:25 +08:00
|
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-04-22 19:21:51 +08:00
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
|
2015-04-18 02:15:22 +08:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use File::Spec;
|
2016-01-30 08:05:33 +08:00
|
|
|
use OpenSSL::Test qw/:DEFAULT srctop_file/;
|
2015-04-18 02:15:22 +08:00
|
|
|
|
|
|
|
setup("test_crl");
|
|
|
|
|
2017-04-26 00:25:42 +08:00
|
|
|
plan tests => 7;
|
2015-04-18 02:15:22 +08:00
|
|
|
|
2016-01-30 08:05:33 +08:00
|
|
|
require_ok(srctop_file('test','recipes','tconversion.pl'));
|
2015-04-18 02:15:22 +08:00
|
|
|
|
2017-04-26 00:25:42 +08:00
|
|
|
my $pem = srctop_file("test/certs", "cyrillic_crl.pem");
|
|
|
|
my $out = "cyrillic_crl.out";
|
|
|
|
my $utf = srctop_file("test/certs", "cyrillic_crl.utf8");
|
|
|
|
|
2015-04-18 02:15:22 +08:00
|
|
|
subtest 'crl conversions' => sub {
|
2016-01-30 08:05:33 +08:00
|
|
|
tconversion("crl", srctop_file("test","testcrl.pem"));
|
2015-04-18 02:15:22 +08:00
|
|
|
};
|
2016-11-29 04:33:40 +08:00
|
|
|
|
|
|
|
ok(run(test(['crltest'])));
|
2017-01-29 01:24:40 +08:00
|
|
|
|
|
|
|
ok(compare1stline([qw{openssl crl -noout -fingerprint -in},
|
|
|
|
srctop_file('test', 'testcrl.pem')],
|
|
|
|
'SHA1 Fingerprint=BA:F4:1B:AD:7A:9B:2F:09:16:BC:60:A7:0E:CE:79:2E:36:00:E7:B2'));
|
|
|
|
ok(compare1stline([qw{openssl crl -noout -fingerprint -sha256 -in},
|
|
|
|
srctop_file('test', 'testcrl.pem')],
|
|
|
|
'SHA256 Fingerprint=B3:A9:FD:A7:2E:8C:3D:DF:D0:F1:C3:1A:96:60:B5:FD:B0:99:7C:7F:0E:E4:34:F5:DB:87:62:36:BC:F1:BC:1B'));
|
|
|
|
|
2017-04-26 00:25:42 +08:00
|
|
|
ok(run(app(["openssl", "crl", "-text", "-in", $pem, "-out", $out,
|
|
|
|
"-nameopt", "utf8"])));
|
|
|
|
is(cmp_text($out, srctop_file("test/certs", "cyrillic_crl.utf8")),
|
|
|
|
0, 'Comparing utf8 output');
|
|
|
|
|
2017-01-29 01:24:40 +08:00
|
|
|
sub compare1stline {
|
|
|
|
my ($cmdarray, $str) = @_;
|
|
|
|
my @lines = run(app($cmdarray), capture => 1);
|
|
|
|
|
|
|
|
return 1 if $lines[0] =~ m|^\Q${str}\E\R$|;
|
|
|
|
note "Got ", $lines[0];
|
|
|
|
note "Expected ", $str;
|
|
|
|
return 0;
|
|
|
|
}
|