Score:1

RSA Private Key Format Without Chinese Remainder Theorem

ca flag

I've been implementing RSA as a learning exercise and am at a point now where I'd like to try serializing my key to a file using some standard format. I've implemented it without using the Chinese Remainder Theorem, so my private key is composed only of my modulus $n=pq$ and my modular inverse exponent $d$. I've seen that PKCS1 & PKCS8 expect the use of the Chinese Remainder theorem. I know that I could simply derive these values, but is there any standard format where I can encode only my $n$ and $d$ without deriving the values for CRT implementations?

Score:1
my flag

is there any standard format where I can encode only my n and d without deriving the values for CRT implementations?

Actually, for the standard PKCS #1 private key format, the CRT parameters are optional. As you can read in the linked text, one of the options is that the private key just stores $n$ and $d$.

dave_thompson_085 avatar
cn flag
3.2 defines abstract representation(s) not directly serializable; A.1.2 defines ASN.1 that is serializable and requires CRT (except the 'multi-prime' part is optional). OTOH [JOSE/JWK](https://www.rfc-editor.org/rfc/rfc7518.html#section-6.3.2) makes the CRT fields 'should' -- recommended but not required. OpenPGP contains p,q but not dp,dq and pinv instead of qinv -- always. PKCS11 transfers each field separately on the API but the supported and required fields (beyond n,e,d) are up to the 'token' i.e. device or instance.
poncho avatar
my flag
@dave_thompson_085: I remember a version of the PKCS #1 private key format with only the n, e, d fields (just omitting the others). However, all the references I now check have the CRT parameters mandatory...
I sit in a Tesla and translated this thread with Ai:

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.