Forum: Ruby-core Error in OpenSSL documentation section: Loading a key

1c4500c91af486c885af8bb84eefd063?d=identicon&s=25 Rob N. (rob_n)
on 2014-08-06 14:51
(Received via mailing list)
Issue #10115 has been updated by Rob Nichols.


 I think the same error is also in the docs for previous version of the
Ruby

----------------------------------------
Feature #10115: Error in OpenSSL documentation section: Loading a key
https://bugs.ruby-lang.org/issues/10115#change-48222

* Author: Rob Nichols
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version: Ruby 2.1.0
----------------------------------------
The entry in the OpenSSL docs for Loading a key has an error in it I
believe.

  http://ruby-doc.org/stdlib-2.1.2/libdoc/openssl/rd...

This is the entry:

> Loading a Key¶ ↑
>
> A key can also be loaded from a file.
>
~~~
> key2 = OpenSSL::PKey::RSA.new File.read 'private_key.pem'
> key2.public? # => true
~~~
> or
>
~~~
> key3 = OpenSSL::PKey::RSA.new File.read 'public_key.pem'
> key3.private? # => false
~~~

I think it should key2.private? that is true, rather than key2.public?
be:

> Loading a Key¶ ↑
>
> A key can also be loaded from a file.
>
~~~
> key2 = OpenSSL::PKey::RSA.new File.read 'private_key.pem'
> key2.private? # => true
~~~
> or
>
~~~
> key3 = OpenSSL::PKey::RSA.new File.read 'public_key.pem'
> key3.private? # => false
~~~
This topic is locked and can not be replied to.