token-import: bind only relevant subkeys
This commit is contained in:
@@ -79,7 +79,7 @@ class ManageSecurityTokenContract {
|
||||
void hideAction();
|
||||
|
||||
void operationImportKey(byte[] importKeyData);
|
||||
void operationPromote(long masterKeyId, byte[] cardAid);
|
||||
void operationPromote(long masterKeyId, byte[] cardAid, long[] subKeyIds);
|
||||
void operationResetSecurityToken();
|
||||
void operationChangePinSecurityToken(String adminPin, String newPin);
|
||||
|
||||
|
||||
@@ -277,12 +277,12 @@ public class ManageSecurityTokenFragment extends Fragment implements ManageSecur
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPromote(long masterKeyId, byte[] cardAid) {
|
||||
public void operationPromote(long masterKeyId, byte[] cardAid, long[] subkeys) {
|
||||
if (currentImportKeyringParcel != null) {
|
||||
throw new IllegalStateException("Cannot trigger import operation twice!");
|
||||
}
|
||||
|
||||
currentPromoteKeyringParcel = PromoteKeyringParcel.createPromoteKeyringParcel(masterKeyId, cardAid, null);
|
||||
currentPromoteKeyringParcel = PromoteKeyringParcel.createPromoteKeyringParcel(masterKeyId, cardAid, subkeys);
|
||||
cryptoPromoteOperationHelper.setOperationMinimumDelay(1000L);
|
||||
cryptoPromoteOperationHelper.cryptoOperation();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.KeyRetr
|
||||
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.KeyserverRetrievalLoader;
|
||||
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.LocalKeyLookupLoader;
|
||||
import org.sufficientlysecure.keychain.ui.token.PublicKeyRetrievalLoader.UriKeyRetrievalLoader;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.ui.util.PermissionsUtil;
|
||||
|
||||
|
||||
@@ -276,13 +277,21 @@ class ManageSecurityTokenPresenter implements ManageSecurityTokenMvpPresenter {
|
||||
if (masterKeyId != null) {
|
||||
this.masterKeyId = masterKeyId;
|
||||
view.statusLineAdd(StatusLine.TOKEN_CHECK);
|
||||
view.operationPromote(masterKeyId, tokenInfo.getAid());
|
||||
|
||||
promoteKeyWithTokenInfo(masterKeyId);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Method can only be called with successful result!");
|
||||
}
|
||||
|
||||
private void promoteKeyWithTokenInfo(Long masterKeyId) {
|
||||
long signKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(tokenInfo.getFingerprintSign());
|
||||
long decryptKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(tokenInfo.getFingerprintDecrypt());
|
||||
long authKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(tokenInfo.getFingerprintAuth());
|
||||
view.operationPromote(masterKeyId, tokenInfo.getAid(), new long[] { signKeyId, decryptKeyId, authKeyId });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickImport() {
|
||||
view.statusLineAdd(StatusLine.IMPORT);
|
||||
@@ -296,7 +305,7 @@ class ManageSecurityTokenPresenter implements ManageSecurityTokenMvpPresenter {
|
||||
|
||||
view.statusLineOk();
|
||||
view.statusLineAdd(StatusLine.TOKEN_PROMOTE);
|
||||
view.operationPromote(masterKeyId, tokenInfo.getAid());
|
||||
promoteKeyWithTokenInfo(masterKeyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user