Can Anyone Explain what keys are in dict of jwk when generating key

Viewed 864

Can anyone help regarding this?? I generated a key in python using jwk using below command and stored in a variable key

key = jwk.JWK.generate(kty='RSA', size=512)

and when i used key.export() it returned the below dict

{'d': 'Z1apo6KRMoS0xyqqTu7lEwZ7f_AON_tve42nSUkwXypMF1rDNj_xgIn9J5I4TvAisUaRYq82uZfYf76eMgj8uQ',
 'dp': '4k-hSfYmT8H2zdHVFVQpBD-_w5G9ASSADgKn3F08AAs',
 'dq': 'E4fXlCY6oT3yPTnOb3LvLxMtKDPmwoI-FLYbNP2L0-k',
 'e': 'AQAB',
 'kty': 'RSA',
 'n': 'wuALgiButVPQy8bCnSkvU-QlBqYB5pk6rfwlcTr-csc8DOvPzekHJYWPjbP_ptAxSW3r5Bnpac1MDgMQKFjOtw',
 'p': '8ZI61ugJ3WblKvY-JfkyWXUcdoGAWQB8B9VcfWRvLuM',
 'q': 'zoPN8ItkA_0rf_XobRkjhYIdtoXyOLXCqYSU0i8etR0',
 'qi': 'JhXuF6EDTrrPysGzsVhco4hpVsSHCXgS7UGZUISc2Ug'}

can anyone explain what are the keys in this dict like d, dp, dq, e, n, p, q, qi

1 Answers

You generated a JWK (JSON Web Key), a special representation of a key. In your case it's an RSA Key which contains the parameters for the private and the public key.

Please refer to the RFC7517 for the general keys. e.g.

  • "kty" (Key Type) Parameter

and RFC7518 for the algorithm specific part.

n and e are the modulus and exponent of the public key, all others are used for the private key. Section 6.3 of the RFC7518 lists all the specific entries of the RSA key:

  • "n" (Modulus) Parameter
  • "e" (Exponent) Parameter
  • "d" (Private Exponent) Parameter
  • "p" (First Prime Factor) Parameter
  • "q" (Second Prime Factor) Parameter
  • "dp" (First Factor CRT Exponent) Parameter
  • "dq" (Second Factor CRT Exponent) Parameter
  • "qi" (First CRT Coefficient) Parameter
Related