Skip to content

Commit fb86349

Browse files
authored
Merge pull request #238 from subrahmanyaman/rsa_import_wychproof_fix
Correction in the calcuclation of RSA KeySize in importKey
2 parents e4e7240 + 2f2879e commit fb86349

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3551,7 +3551,7 @@ private void importRSAKey(byte[] scratchPad) {
35513551
// check the keysize tag if present in key parameters.
35523552
short keysize =
35533553
KMIntegerTag.getShortValue(KMType.UINT_TAG, KMType.KEYSIZE, data[KEY_PARAMETERS]);
3554-
short kSize = (short) (KMByteBlob.length(data[SECRET]) * 8);
3554+
short kSize = (short) (KMByteBlob.length(data[PUB_KEY]) * 8);
35553555
if (keysize != KMType.INVALID_VALUE) {
35563556
if (keysize != 2048 || (keysize != kSize)) {
35573557
KMException.throwIt(KMError.IMPORT_PARAMETER_MISMATCH);

0 commit comments

Comments
 (0)