[ruby/openssl] Fix signing example to not use Digest instance

https://github.com/ruby/openssl/commit/033fb4fbe4
This commit is contained in:
Bart de Water 2020-04-20 18:18:57 -04:00 коммит произвёл Kazuki Yamaguchi
Родитель c85789f9b2
Коммит a7145c3de4
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -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 * To sign a document, a cryptographically secure hash of the document is
* computed first, which is then signed using the private key. * computed first, which is then signed using the private key.
* *
* digest = OpenSSL::Digest.new('SHA256') * signature = key.sign 'SHA256', document
* signature = key.sign digest, document
* *
* To validate the signature, again a hash of the document is computed and * 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 * 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 * compared to the hash just computed, if they are equal the signature was
* valid. * valid.
* *
* digest = OpenSSL::Digest.new('SHA256') * if key.verify 'SHA256', signature, document
* if key.verify digest, signature, document
* puts 'Valid' * puts 'Valid'
* else * else
* puts 'Invalid' * puts 'Invalid'