From 38e4043d735f406c81173322f30e2a37d97101f5 Mon Sep 17 00:00:00 2001 From: William Ahern Date: Sat, 29 Oct 2016 16:58:34 -0700 Subject: add and use pkey:getDefaultDigestName because the old digest type names used in examples/vrfy.sig are not accepted by OpenSSL 1.1 --- examples/vrfy.sig | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/vrfy.sig b/examples/vrfy.sig index 258490a..f6cc927 100755 --- a/examples/vrfy.sig +++ b/examples/vrfy.sig @@ -13,16 +13,18 @@ local digest = require"openssl.digest" local function genkey(type) type = string.upper(type or (not openssl.NO_EC and "EC") or "RSA") + local key if type == "RSA" then - return pkey.new{ type = "RSA", bits = 1024 }, "sha256" + return pkey.new{ type = "RSA", bits = 1024 } elseif type == "DSA" then - return pkey.new{ type = "DSA", bits = 1024 }, "dss1" + return pkey.new{ type = "DSA", bits = 1024 } else - return pkey.new{ type = "EC", curve = "prime192v1" }, "ecdsa-with-SHA1" + return pkey.new{ type = "EC", curve = "prime192v1" } end end -local key, hash = genkey(keytype) +local key = genkey(keytype) +local hash = key:getDefaultDigestName() -- digest our message using an appropriate digest ("ecdsa-with-SHA1" for EC; -- "dss1" for DSA; and "sha1", "sha256", etc for RSA). @@ -45,6 +47,7 @@ local function tohex(b) return x end -print("okay", pub:verify(sig, data)) -print("type", pub:type()) -print("sig", tohex(sig)) +print("verified", pub:verify(sig, data)) +print("key-type", pub:type()) +print("hash-type", hash) +print("signature", tohex(sig)) -- cgit v1.2.3-59-g8ed1b