Merge pull request #2122 from af-anssi/fix-secure-messaging
fix issue #2049
This commit is contained in:
commit
3057eaa813
|
@ -108,7 +108,16 @@ public class OpenPgpCapabilities {
|
||||||
mHasKeyImport = (v[0] & MASK_KEY_IMPORT) != 0;
|
mHasKeyImport = (v[0] & MASK_KEY_IMPORT) != 0;
|
||||||
mAttriburesChangable = (v[0] & MASK_ATTRIBUTES_CHANGABLE) != 0;
|
mAttriburesChangable = (v[0] & MASK_ATTRIBUTES_CHANGABLE) != 0;
|
||||||
|
|
||||||
mSMAESKeySize = (v[1] == 1) ? 16 : 32;
|
mSMAESKeySize = 0;
|
||||||
|
|
||||||
|
switch(v[1]) {
|
||||||
|
case 1:
|
||||||
|
mSMAESKeySize = 16;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
mSMAESKeySize = 32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mMaxCmdLen = (v[6] << 8) + v[7];
|
mMaxCmdLen = (v[6] << 8) + v[7];
|
||||||
mMaxRspLen = (v[8] << 8) + v[9];
|
mMaxRspLen = (v[8] << 8) + v[9];
|
||||||
|
@ -142,6 +151,10 @@ public class OpenPgpCapabilities {
|
||||||
return mSMAESKeySize;
|
return mSMAESKeySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isHasAESSM() {
|
||||||
|
return isHasSM() && ((mSMAESKeySize == 16) || (mSMAESKeySize == 32));
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxCmdLen() {
|
public int getMaxCmdLen() {
|
||||||
return mMaxCmdLen;
|
return mMaxCmdLen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class SecurityTokenHelper {
|
||||||
mPw1ValidatedForDecrypt = false;
|
mPw1ValidatedForDecrypt = false;
|
||||||
mPw3Validated = false;
|
mPw3Validated = false;
|
||||||
|
|
||||||
if (mOpenPgpCapabilities.isHasSM()) {
|
if (mOpenPgpCapabilities.isHasAESSM()) {
|
||||||
try {
|
try {
|
||||||
SCP11bSecureMessaging.establish(this, ctx);
|
SCP11bSecureMessaging.establish(this, ctx);
|
||||||
} catch (SecureMessagingException e) {
|
} catch (SecureMessagingException e) {
|
||||||
|
|
Loading…
Reference in a new issue