diff options
author | William Ahern <william@25thandclement.com> | 2016-10-29 16:58:34 -0700 |
---|---|---|
committer | William Ahern <william@25thandclement.com> | 2016-10-29 16:58:34 -0700 |
commit | 38e4043d735f406c81173322f30e2a37d97101f5 (patch) | |
tree | 1c81611454c2756a8786bd22f528b12bbf3a49be /examples | |
parent | 8aa467e04b93b62fef6a1b225944d82f00ff2168 (diff) | |
download | luaossl-38e4043d735f406c81173322f30e2a37d97101f5.tar.gz luaossl-38e4043d735f406c81173322f30e2a37d97101f5.tar.bz2 luaossl-38e4043d735f406c81173322f30e2a37d97101f5.zip |
add and use pkey:getDefaultDigestName because the old digest type names used in examples/vrfy.sig are not accepted by OpenSSL 1.1
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/vrfy.sig | 17 |
1 files changed, 10 insertions, 7 deletions
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)) |