Skip to content

Commit 033fb4f

Browse files
bdewaterioquatix
authored andcommitted
Fix signing example to not use Digest instance
1 parent b08ae7e commit 033fb4f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ext/openssl/ossl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -739,16 +739,14 @@ ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2)
739739
* To sign a document, a cryptographically secure hash of the document is
740740
* computed first, which is then signed using the private key.
741741
*
742-
* digest = OpenSSL::Digest.new('SHA256')
743-
* signature = key.sign digest, document
742+
* signature = key.sign 'SHA256', document
744743
*
745744
* To validate the signature, again a hash of the document is computed and
746745
* the signature is decrypted using the public key. The result is then
747746
* compared to the hash just computed, if they are equal the signature was
748747
* valid.
749748
*
750-
* digest = OpenSSL::Digest.new('SHA256')
751-
* if key.verify digest, signature, document
749+
* if key.verify 'SHA256', signature, document
752750
* puts 'Valid'
753751
* else
754752
* puts 'Invalid'

0 commit comments

Comments
 (0)