aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_hmac.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2020-05-13 18:15:08 +0900
committerKazuki Yamaguchi <k@rhe.jp>2020-05-13 18:19:38 +0900
commit93213b2730a45fe997b8e581c64c42e13cd9abde (patch)
treedd17c9844290a490d0ca769d5a62a134f73e2274 /ext/openssl/ossl_hmac.c
parentd669d7158266c7943d191be9dd39f3be2df7cf57 (diff)
downloadruby-openssl-93213b2730a45fe997b8e581c64c42e13cd9abde.tar.gz
digest, hmac, ts, x509: use IO.binread in examples where appropriate
IO.read may mangle line separator, which will corrupt binary data including DER-encoded X.509 certificates and such. Fixes: https://github.com/ruby/openssl/issues/243
Diffstat (limited to 'ext/openssl/ossl_hmac.c')
-rw-r--r--ext/openssl/ossl_hmac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index e831cff5..70e9fb81 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -350,8 +350,8 @@ Init_ossl_hmac(void)
*
* === HMAC-SHA256 using incremental interface
*
- * data1 = File.read("file1")
- * data2 = File.read("file2")
+ * data1 = File.binread("file1")
+ * data2 = File.binread("file2")
* key = "key"
* digest = OpenSSL::Digest.new('SHA256')
* hmac = OpenSSL::HMAC.new(key, digest)