mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-05 00:35:08 -05:00
use correct pin for nfc in EncryptActivity
This commit is contained in:
parent
c7b0f77c9b
commit
e0da0f6eb5
@ -569,7 +569,7 @@ public class PgpSignEncrypt {
|
||||
log.add(LogType.MSG_SE_PENDING_NFC, indent);
|
||||
SignEncryptResult result =
|
||||
new SignEncryptResult(SignEncryptResult.RESULT_PENDING_NFC, log);
|
||||
result.setNfcData(e.hashToSign, e.hashAlgo, e.creationTimestamp);
|
||||
result.setNfcData(e.hashToSign, e.hashAlgo, e.creationTimestamp, mSignaturePassphrase);
|
||||
Log.d(Constants.TAG, "e.hashToSign"+ Hex.toHexString(e.hashToSign));
|
||||
return result;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public class SignEncryptResult extends OperationResult {
|
||||
byte[] mNfcHash;
|
||||
int mNfcAlgo;
|
||||
Date mNfcTimestamp;
|
||||
String mNfcPassphrase;
|
||||
|
||||
public long getKeyIdPassphraseNeeded() {
|
||||
return mKeyIdPassphraseNeeded;
|
||||
@ -44,10 +45,11 @@ public class SignEncryptResult extends OperationResult {
|
||||
mKeyIdPassphraseNeeded = keyIdPassphraseNeeded;
|
||||
}
|
||||
|
||||
public void setNfcData(byte[] nfcHash, int nfcAlgo, Date nfcTimestamp) {
|
||||
public void setNfcData(byte[] nfcHash, int nfcAlgo, Date nfcTimestamp, String passphrase) {
|
||||
mNfcHash = nfcHash;
|
||||
mNfcAlgo = nfcAlgo;
|
||||
mNfcTimestamp = nfcTimestamp;
|
||||
mNfcPassphrase = passphrase;
|
||||
}
|
||||
|
||||
public byte[] getNfcHash() {
|
||||
@ -62,6 +64,10 @@ public class SignEncryptResult extends OperationResult {
|
||||
return mNfcTimestamp;
|
||||
}
|
||||
|
||||
public String getNfcPassphrase() {
|
||||
return mNfcPassphrase;
|
||||
}
|
||||
|
||||
public boolean isPending() {
|
||||
return (mResult & RESULT_PENDING) == RESULT_PENDING;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv
|
||||
SignEncryptResult.RESULT_PENDING_NFC) {
|
||||
|
||||
mNfcTimestamp = pgpResult.getNfcTimestamp();
|
||||
startNfcSign("123456", pgpResult.getNfcHash(), pgpResult.getNfcAlgo());
|
||||
startNfcSign(pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo());
|
||||
} else {
|
||||
throw new RuntimeException("Unhandled pending result!");
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public class NfcActivity extends ActionBarActivity {
|
||||
|
||||
// always
|
||||
public static final String EXTRA_PIN = "pin";
|
||||
public static final String EXTRA_FINGERPRINT = "fingerprint";
|
||||
// special extra for OpenPgpService
|
||||
public static final String EXTRA_DATA = "data";
|
||||
|
||||
@ -63,6 +64,8 @@ public class NfcActivity extends ActionBarActivity {
|
||||
|
||||
private String mPin;
|
||||
|
||||
private byte[] mFingerprint;
|
||||
|
||||
// sign
|
||||
private byte[] mHashToSign;
|
||||
private int mHashAlgo;
|
||||
@ -83,6 +86,9 @@ public class NfcActivity extends ActionBarActivity {
|
||||
Bundle data = intent.getExtras();
|
||||
String action = intent.getAction();
|
||||
|
||||
// TODO check fingerprint
|
||||
// mFingerprint = data.getByteArray(EXTRA_FINGERPRINT);
|
||||
|
||||
if (ACTION_SIGN_HASH.equals(action)) {
|
||||
mAction = action;
|
||||
mPin = data.getString(EXTRA_PIN);
|
||||
|
Loading…
Reference in New Issue
Block a user