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

Misleading documentation in crypto.publicEncrypt and publicDecrypt #13633

Closed
rinne opened this issue Jun 12, 2017 · 0 comments
Closed

Misleading documentation in crypto.publicEncrypt and publicDecrypt #13633

rinne opened this issue Jun 12, 2017 · 0 comments
Labels
crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations.

Comments

@rinne
Copy link

rinne commented Jun 12, 2017

  • Version: Any > 4.0
  • Platform: Any
  • Subsystem: crypto / documentation
$ node -p process.versions
{ http_parser: '2.7.0',
  node: '8.1.0',
  v8: '5.8.283.41',
  uv: '1.12.0',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  modules: '57',
  openssl: '1.0.2l',
  icu: '58.2',
  unicode: '9.0',
  cldr: '30.0.3',
  tz: '2016j' }
$ node -p process.versions
{ http_parser: '2.7.0',
  node: '4.6.1',
  v8: '4.5.103.37',
  uv: '1.9.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  modules: '46',
  openssl: '1.0.2j-fips' }

Documentation of the crypto session of node.js is wrong. Even in public key encrypt/decrypt it talks about:

crypto.publicEncrypt(public_key, buffer)

Added in: v0.11.14
public_key <Object> | <string>
key <string> A PEM encoded private key.
...

It does say later that the private key can be used instead of the public key, but still it's clearly wrong. Also it is related to #13612 in a way, that whereas if private key is submitted to this function, it can contain whitespace and/or other garble before the key. On the other hand, if a public key is submitted, the public key header must start immediately from the beginning of the string without any leading whitespace or line feeds or the operation fails.

@seishun seishun added good first issue Issues that are suitable for first-time contributors. and removed good first issue Issues that are suitable for first-time contributors. labels Jun 12, 2017
@mscdex mscdex added crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations. labels Jun 12, 2017
pomerantsev added a commit to pomerantsev/node that referenced this issue Oct 6, 2017
Fixes nodejs#13633

Although, as docs mention, private keys can be used instead of
public keys, I presume that these parameter explanations
should be corrected.
MylesBorins pushed a commit that referenced this issue Oct 7, 2017
Although, as docs mention, private keys can be used instead of
public keys, I presume that these parameter explanations
should be corrected.

Fixes: #13633
PR-URL: #16038
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Oct 11, 2017
Although, as docs mention, private keys can be used instead of
public keys, I presume that these parameter explanations
should be corrected.

Fixes: #13633
PR-URL: #16038
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit to addaleax/ayo that referenced this issue Oct 12, 2017
Although, as docs mention, private keys can be used instead of
public keys, I presume that these parameter explanations
should be corrected.

Fixes: nodejs/node#13633
PR-URL: nodejs/node#16038
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants