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