Skip to content

Commit

Permalink
Merge pull request #238 from subrahmanyaman/rsa_import_wychproof_fix
Browse files Browse the repository at this point in the history
Correction in the calcuclation of RSA KeySize in importKey
  • Loading branch information
mdwivedi authored Nov 22, 2022
2 parents e4e7240 + 2f2879e commit fb86349
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3551,7 +3551,7 @@ private void importRSAKey(byte[] scratchPad) {
// check the keysize tag if present in key parameters.
short keysize =
KMIntegerTag.getShortValue(KMType.UINT_TAG, KMType.KEYSIZE, data[KEY_PARAMETERS]);
short kSize = (short) (KMByteBlob.length(data[SECRET]) * 8);
short kSize = (short) (KMByteBlob.length(data[PUB_KEY]) * 8);
if (keysize != KMType.INVALID_VALUE) {
if (keysize != 2048 || (keysize != kSize)) {
KMException.throwIt(KMError.IMPORT_PARAMETER_MISMATCH);
Expand Down

0 comments on commit fb86349

Please sign in to comment.