aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-05-28 17:33:28 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-05-28 17:33:42 +0200
commit34c26fe5d1b0ae3b69a264d56e2b3752711410ca (patch)
treeee4944b051c51d76dcf81e455941d0b0aa18425f
parent1463bae1b43ffbac6672a19cc87ac1dbcfca9530 (diff)
downloadopen-keychain-34c26fe5d1b0ae3b69a264d56e2b3752711410ca.tar.gz
open-keychain-34c26fe5d1b0ae3b69a264d56e2b3752711410ca.tar.bz2
open-keychain-34c26fe5d1b0ae3b69a264d56e2b3752711410ca.zip
shorten fp data to 20 bytes for convertFingerprintToHex in NfcBaseOperation
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java
index e2c36c60d..61db8552b 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java
@@ -18,6 +18,7 @@
package org.sufficientlysecure.keychain.ui;
import java.io.IOException;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import android.app.Activity;
@@ -57,7 +58,6 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe
CreateKeyActivity mCreateKeyActivity;
private byte[] mNfcFingerprints;
- private long mNfcMasterKeyId;
private byte[] mNfcAid;
private String mNfcUserId;
private String mNfcFingerprint;
@@ -88,8 +88,9 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe
mNfcAid = args.getByteArray(ARG_AID);
mNfcUserId = args.getString(ARG_USER_ID);
- mNfcMasterKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(mNfcFingerprints);
- mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(mNfcFingerprints);
+ byte[] fp = new byte[20];
+ ByteBuffer.wrap(fp).put(mNfcFingerprints, 0, 20);
+ mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(fp);
}
@@ -226,9 +227,8 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe
intent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING);
- String hexFp = KeyFormattingUtils.convertFingerprintToHex(mNfcFingerprints);
ArrayList<ParcelableKeyRing> keyList = new ArrayList<>();
- keyList.add(new ParcelableKeyRing(hexFp, null, null));
+ keyList.add(new ParcelableKeyRing(mNfcFingerprint, null, null));
data.putParcelableArrayList(KeychainIntentService.IMPORT_KEY_LIST, keyList);
{
@@ -258,8 +258,9 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe
mNfcAid = mCreateKeyActivity.nfcGetAid();
mNfcUserId = mCreateKeyActivity.nfcGetUserId();
- mNfcMasterKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(mNfcFingerprints);
- mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(mNfcFingerprints);
+ byte[] fp = new byte[20];
+ ByteBuffer.wrap(fp).put(mNfcFingerprints, 0, 20);
+ mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(fp);
setData();
refreshSearch();