summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Yang <kaishen.yy@antfin.com>2019-07-30 23:05:44 +0800
committerPaul Yang <kaishen.yy@antfin.com>2019-08-22 10:29:28 +0800
commita45eb7e8918f055115e0a1f206f8b74a2ed06dc6 (patch)
tree9a77fbfe998f92c122df0f914c9b09dd57be3216 /test
parente1178600cc5d40b1e21c4a01d224afd2d8c7498a (diff)
Support parsing of SM2 ID in hexdecimal
The current EVP_PEKY_ctrl for SM2 has no capability of parsing an ID input in hexdecimal. The newly added ctrl string is called: sm2_hex_id Test cases and documentation are updated. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9584)
Diffstat (limited to 'test')
-rw-r--r--test/recipes/25-test_req.t15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/recipes/25-test_req.t b/test/recipes/25-test_req.t
index 127b338634..7dae692482 100644
--- a/test/recipes/25-test_req.t
+++ b/test/recipes/25-test_req.t
@@ -59,10 +59,10 @@ subtest "generating certificate requests" => sub {
};
subtest "generating SM2 certificate requests" => sub {
- plan tests => 2;
+ plan tests => 4;
SKIP: {
- skip "SM2 is not supported by this OpenSSL build", 2
+ skip "SM2 is not supported by this OpenSSL build", 4
if disabled("sm2");
ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
"-new", "-key", srctop_file("test", "certs", "sm2.key"),
@@ -74,6 +74,17 @@ subtest "generating SM2 certificate requests" => sub {
"-verify", "-in", "testreq.pem", "-noout",
"-sm2-id", "1234567812345678", "-sm3"])),
"Verifying signature on SM2 certificate request");
+
+ ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
+ "-new", "-key", srctop_file("test", "certs", "sm2.key"),
+ "-sigopt", "sm2_hex_id:DEADBEEF",
+ "-out", "testreq.pem", "-sm3"])),
+ "Generating SM2 certificate request with hex id");
+
+ ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
+ "-verify", "-in", "testreq.pem", "-noout",
+ "-sm2-hex-id", "DEADBEEF", "-sm3"])),
+ "Verifying signature on SM2 certificate request");
}
};