Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doc for OpenSSL::X509::Certificate #243

Closed
Nimesh-Msys opened this issue Feb 15, 2019 · 0 comments
Closed

Update doc for OpenSSL::X509::Certificate #243

Nimesh-Msys opened this issue Feb 15, 2019 · 0 comments

Comments

@Nimesh-Msys
Copy link

I think the following documentation is incomplete and should be updated.

* raw = File.read "cert.cer" # DER- or PEM-encoded
* certificate = OpenSSL::X509::Certificate.new raw

DER-encoded certificates are binary and read by using File.binread.
File.read gives the error:

OpenSSL::X509::CertificateError (not enough data)

Hence to avoid confusions, the document should be something like:

  *   raw = File.read "cert.cer" # PEM-encoded 
  *   # For DER-encoded: raw = File.binread "cert.cer"
  *   certificate = OpenSSL::X509::Certificate.new raw 

Or may be a note to inform this.

nobu pushed a commit to nobu/ruby that referenced this issue Feb 14, 2021
…re appropriate

IO.read may mangle line separator, which will corrupt binary data
including DER-encoded X.509 certificates and such.

Fixes: ruby/openssl#243

ruby/openssl@93213b2730
rhenium added a commit to rhenium/ruby that referenced this issue Mar 16, 2021
…re appropriate

IO.read may mangle line separator, which will corrupt binary data
including DER-encoded X.509 certificates and such.

Fixes: ruby/openssl#243

ruby/openssl@93213b2730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant