diff options
author | Bart de Water <bartdewater@gmail.com> | 2020-04-20 18:18:57 -0400 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-04-21 16:33:09 +1200 |
commit | 033fb4fbe4b72303c1bf1fccce8985f7f2acda73 (patch) | |
tree | 3ae21aa20de1ea0a9b55bab135ff74aeebbd32d8 /ext | |
parent | b08ae7e73d10b46164b3d2304df0cf59d3d55099 (diff) | |
download | ruby-openssl-033fb4fbe4b72303c1bf1fccce8985f7f2acda73.tar.gz |
Fix signing example to not use Digest instance
Diffstat (limited to 'ext')
-rw-r--r-- | ext/openssl/ossl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 5d3ee741..2f54b861 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -739,16 +739,14 @@ ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2) * To sign a document, a cryptographically secure hash of the document is * computed first, which is then signed using the private key. * - * digest = OpenSSL::Digest.new('SHA256') - * signature = key.sign digest, document + * signature = key.sign 'SHA256', document * * To validate the signature, again a hash of the document is computed and * the signature is decrypted using the public key. The result is then * compared to the hash just computed, if they are equal the signature was * valid. * - * digest = OpenSSL::Digest.new('SHA256') - * if key.verify digest, signature, document + * if key.verify 'SHA256', signature, document * puts 'Valid' * else * puts 'Invalid' |