]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/20-test_pkeyutl.t
2 # Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
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
13 use OpenSSL
::Test qw
/:DEFAULT srctop_file/;
14 use OpenSSL
::Test
::Utils
;
16 setup
("test_pkeyutl");
22 # Utilize the sm2.crt as the TBS file
23 return run
(app
(([ 'openssl', 'pkeyutl', '-sign',
24 '-in', srctop_file
('test', 'certs', 'sm2.crt'),
25 '-inkey', srctop_file
('test', 'certs', 'sm2.key'),
26 '-out', 'signature.sm2', '-rawin',
27 '-digest', 'sm3', '-pkeyopt', 'sm2_id:someid'])));
32 # Utilize the sm2.crt as the TBS file
33 return run
(app
(([ 'openssl', 'pkeyutl', '-verify', '-certin',
34 '-in', srctop_file
('test', 'certs', 'sm2.crt'),
35 '-inkey', srctop_file
('test', 'certs', 'sm2.crt'),
36 '-sigfile', 'signature.sm2', '-rawin',
37 '-digest', 'sm3', '-pkeyopt', 'sm2_id:someid'])));
40 ok
(sign
, "Sign a piece of data using SM2");
41 ok
(verify
, "Verify an SM2 signature against a piece of data");
43 unlink 'signature.sm2';