Score:0

Is it wrong that in a JWK, if the "d" value is **omitted**, that JWK represents a private key?

This is not a programming question. This is to confirm whether a crypto documentation is incorrect.

I am using Rust's p384 crate. I am creating a private key from a JWK string.

In the source code, at line 85:

https://docs.rs/elliptic-curve/latest/src/elliptic_curve/jwk.rs.html#85

it says:

The `d` ECC private key parameter as described in RFC 7518 6.2.2.1:
<https://tools.ietf.org/html/rfc7518#section-6.2.2.1>
Value is optional and if omitted, this JWK represents a private key.

Isn't the last line wrong? It says "if omitted, this JWK represents a private key".

Shouldn't it say "if present, this JWK represents a private key"?

The RFC it links to:

https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.2.1

says:

The "d" (ECC private key) parameter contains the Elliptic Curve private key value.

So, if this d value is omitted (as per the code comments), that wouldn't be a private key from what I understand.

Score:1
vu flag

I'm fairly confident that it's supposed to be "public key".

$d$ is the typical label for any "scalar" private key - decryption exponent in RSA or scalar factor in ECC. In RSA, public key is colloquially $(n,e)$, while in ECC, it's $Q$.

sudoExclaimationExclaimation avatar
Thanks. I will file a bug report.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.