SPRUIV7B May 2022 – September 2023 AM620-Q1 , AM623 , AM625 , AM625-Q1 , AM625SIP
Degenerate RSA keys are valid RSA keys with the private exponent set to 1. This results in the signature field being equal to the digest, since in RSA:
Where n is the key size. Since the hash used is SHA-512 and the signature is an ASN.1 sequence containing the OID defining which has was used as well as the hash value, the degenerate RSA must have a value of n greater than the maximum digest size. Typically 1024-bit is chosen.
The following sequence is used to generate degenerate RSA keys:
openssl genrsa –out key.pm 1024
openssl rsa –in key.pem –text –noout > key.txt
openssl asn1parse -genconf degenerateKey.txt -out degenerateKey.der
openssl rsa –in degenerateKey.der –inform der -text -check
openssl rsa –in degenerateKey.der –inform der –outform pem -out degenerateKey.pem
An example degenerateKey.txt file is shown.
asn1=SEQUENCE:rsa_key
[rsa_key]
version=INTEGER:0
modulus=INTEGER<copied from key.txt>
pubExp=INTEGER:1
privExp=INTEGER:1
p=INTEGER:<copied from key.txt>
q=INTEGER<copied from key.txt>
e1=INTEGER:1
e2=INTEGER:1
coeff=INTEGER<copied from key.txt>
Note that when copying the multi-byte fields from key.txt it is necessary to remove the colons, catenate the lines and add a preceding 0x.