summaryrefslogtreecommitdiff
path: root/src/node_crypto.cc
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2019-01-27 16:24:40 +0000
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-02-01 10:45:20 +0100
commit80873ec3c2e18c151ddf1c0d79461c48d367206f (patch)
tree40f481fa673cf2ae847c72808bbdc8a2418e75da /src/node_crypto.cc
parent7c9fba30ef51b1e3f9e324bd6d35c8339836c6fe (diff)
downloadandroid-node-v8-80873ec3c2e18c151ddf1c0d79461c48d367206f.tar.gz
android-node-v8-80873ec3c2e18c151ddf1c0d79461c48d367206f.tar.bz2
android-node-v8-80873ec3c2e18c151ddf1c0d79461c48d367206f.zip
crypto: fix public key encoding name in comment
PKCS#8 describes an encoding for private keys, not public keys. Using the name as a format usually refers to the PrivateKeyInfo structure it defines. (Or sometimes the EncryptedPrivateKeyInfo variant or the little-used OneAsymmetricKey extension defined in RFC 5958.) None of these structures can hold public keys to begin with. d2i_PUBKEY actually parses the public key analogous format defined in X.509, SubjectPublicKeyInfo. This function already uses "X.509" to refer to an entire certificate, so say SubjectPublicKeyInfo in the comment. (The abbreviation SPKI sometimes refers to SubjectPublicKeyInfo, e.g. in RFC 7469, but it can also an alternate S-expression-based PKI to X.509, Simple Public Key Infrastructure. To avoid confusion, stick with the expanded name.) PR-URL: https://github.com/nodejs/node/pull/25736 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r--src/node_crypto.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index be6f22a1ac..9715e8b776 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -2748,7 +2748,7 @@ static ParsePublicKeyResult ParsePublicKeyPEM(EVPKeyPointer* pkey,
ParsePublicKeyResult ret;
- // Try PKCS#8 first.
+ // Try parsing as a SubjectPublicKeyInfo first.
ret = TryParsePublicKey(pkey, bp, "PUBLIC KEY",
[](const unsigned char** p, long l) { // NOLINT(runtime/int)
return d2i_PUBKEY(nullptr, p, l);