Adding keytocard flag to SubkeyChange: UI sets this flag to initiate keytocard; operation unsets it and fills in dummyDivert to finish it.
This commit is contained in:
@@ -95,8 +95,8 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
}
|
||||
|
||||
for (SubkeyChange change : mChangeSubKeys) {
|
||||
if (change.mRecertify || change.mFlags != null || change.mExpiry != null ||
|
||||
(change.mDummyDivert != null && change.mDummyDivert.length == 0)) {
|
||||
if (change.mRecertify || change.mFlags != null || change.mExpiry != null
|
||||
|| change.mMoveKeyToCard) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -143,6 +143,8 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
public boolean mRecertify;
|
||||
// if this flag is true, the subkey should be changed to a stripped key
|
||||
public boolean mDummyStrip;
|
||||
// if this flag is true, the subkey should be moved to a card
|
||||
public boolean mMoveKeyToCard;
|
||||
// if this is non-null, the subkey will be changed to a divert-to-card
|
||||
// key for the given serial number
|
||||
public byte[] mDummyDivert;
|
||||
@@ -174,12 +176,25 @@ public class SaveKeyringParcel implements Parcelable {
|
||||
mDummyDivert = dummyDivert;
|
||||
}
|
||||
|
||||
public SubkeyChange(long keyId, boolean dummyStrip, boolean moveKeyToCard) {
|
||||
this(keyId, null, null);
|
||||
|
||||
// these flags are mutually exclusive!
|
||||
if (dummyStrip && moveKeyToCard) {
|
||||
throw new AssertionError(
|
||||
"cannot set strip and keytocard flags at the same time - this is a bug!");
|
||||
}
|
||||
mDummyStrip = dummyStrip;
|
||||
mMoveKeyToCard = moveKeyToCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String out = "mKeyId: " + mKeyId + ", ";
|
||||
out += "mFlags: " + mFlags + ", ";
|
||||
out += "mExpiry: " + mExpiry + ", ";
|
||||
out += "mDummyStrip: " + mDummyStrip + ", ";
|
||||
out += "mMoveKeyToCard: " + mMoveKeyToCard + ", ";
|
||||
out += "mDummyDivert: [" + (mDummyDivert == null ? 0 : mDummyDivert.length) + " bytes]";
|
||||
|
||||
return out;
|
||||
|
||||
Reference in New Issue
Block a user