pass masterKeyId to yubikey fragment

This commit is contained in:
Vincent Breitmoser 2015-05-16 23:59:04 +02:00
parent 4b2c8a1309
commit f554cc9c93
2 changed files with 9 additions and 6 deletions

View File

@ -588,7 +588,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
public void showYubiKeyFragment(byte[] nfcFingerprints, String nfcUserId, byte[] nfcAid) { public void showYubiKeyFragment(byte[] nfcFingerprints, String nfcUserId, byte[] nfcAid) {
ViewKeyYubiKeyFragment frag = ViewKeyYubiKeyFragment.newInstance( ViewKeyYubiKeyFragment frag = ViewKeyYubiKeyFragment.newInstance(
nfcFingerprints, nfcUserId, nfcAid); mMasterKeyId, nfcFingerprints, nfcUserId, nfcAid);
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();

View File

@ -45,14 +45,15 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys; import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.ServiceProgressHandler; import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
public class ViewKeyYubiKeyFragment extends Fragment public class ViewKeyYubiKeyFragment extends Fragment
implements LoaderCallbacks<Cursor> { implements LoaderCallbacks<Cursor> {
public static final String ARG_MASTER_KEY_ID = "master_key_id";
public static final String ARG_FINGERPRINT = "fingerprint"; public static final String ARG_FINGERPRINT = "fingerprint";
public static final String ARG_USER_ID = "user_id"; public static final String ARG_USER_ID = "user_id";
public static final String ARG_CARD_AID = "aid"; public static final String ARG_CARD_AID = "aid";
private byte[][] mFingerprints; private byte[][] mFingerprints;
private String mUserId; private String mUserId;
private byte[] mCardAid; private byte[] mCardAid;
@ -60,10 +61,12 @@ public class ViewKeyYubiKeyFragment extends Fragment
private Button vButton; private Button vButton;
private TextView vStatus; private TextView vStatus;
public static ViewKeyYubiKeyFragment newInstance(byte[] fingerprints, String userId, byte[] aid) { public static ViewKeyYubiKeyFragment newInstance(long masterKeyId,
byte[] fingerprints, String userId, byte[] aid) {
ViewKeyYubiKeyFragment frag = new ViewKeyYubiKeyFragment(); ViewKeyYubiKeyFragment frag = new ViewKeyYubiKeyFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong(ARG_MASTER_KEY_ID, masterKeyId);
args.putByteArray(ARG_FINGERPRINT, fingerprints); args.putByteArray(ARG_FINGERPRINT, fingerprints);
args.putString(ARG_USER_ID, userId); args.putString(ARG_USER_ID, userId);
args.putByteArray(ARG_CARD_AID, aid); args.putByteArray(ARG_CARD_AID, aid);
@ -86,7 +89,7 @@ public class ViewKeyYubiKeyFragment extends Fragment
mUserId = args.getString(ARG_USER_ID); mUserId = args.getString(ARG_USER_ID);
mCardAid = args.getByteArray(ARG_CARD_AID); mCardAid = args.getByteArray(ARG_CARD_AID);
mMasterKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(mFingerprints[0]); mMasterKeyId = args.getLong(ARG_MASTER_KEY_ID);
getLoaderManager().initLoader(0, null, this); getLoaderManager().initLoader(0, null, this);
@ -169,8 +172,8 @@ public class ViewKeyYubiKeyFragment extends Fragment
Keys.HAS_SECRET, Keys.HAS_SECRET,
Keys.FINGERPRINT Keys.FINGERPRINT
}; };
private static final int INDEX_KEY_ID = 1; // private static final int INDEX_KEY_ID = 1;
private static final int INDEX_RANK = 2; // private static final int INDEX_RANK = 2;
private static final int INDEX_HAS_SECRET = 3; private static final int INDEX_HAS_SECRET = 3;
private static final int INDEX_FINGERPRINT = 4; private static final int INDEX_FINGERPRINT = 4;