Skip to content

Commit

Permalink
Correction in the calcuclation of RSA KeySize in importKey
Browse files Browse the repository at this point in the history
  • Loading branch information
subrahmanyaman committed Nov 15, 2022
1 parent 1c31b18 commit 2f2879e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3542,7 +3542,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 2f2879e

Please sign in to comment.