Yubikey decryption

This commit is contained in:
Dominik Schürmann
2014-09-24 00:50:58 +02:00
parent 7c82e1c728
commit 07704c2726
8 changed files with 50 additions and 92 deletions

View File

@@ -146,6 +146,7 @@ public class KeychainIntentService extends IntentService implements Progressable
// decrypt/verify
public static final String DECRYPT_CIPHERTEXT_BYTES = "ciphertext_bytes";
public static final String DECRYPT_PASSPHRASE = "passphrase";
public static final String DECRYPT_NFC_DECRYPTED_SESSION_KEY = "nfc_decrypted_session_key";
// save keyring
public static final String EDIT_KEYRING_PARCEL = "save_parcel";
@@ -326,6 +327,7 @@ public class KeychainIntentService extends IntentService implements Progressable
try {
/* Input */
String passphrase = data.getString(DECRYPT_PASSPHRASE);
byte[] nfcDecryptedSessionKey = data.getByteArray(DECRYPT_NFC_DECRYPTED_SESSION_KEY);
InputData inputData = createDecryptInputData(data);
OutputStream outStream = createCryptOutputStream(data);
@@ -342,7 +344,8 @@ public class KeychainIntentService extends IntentService implements Progressable
);
builder.setProgressable(this)
.setAllowSymmetricDecryption(true)
.setPassphrase(passphrase);
.setPassphrase(passphrase)
.setNfcState(nfcDecryptedSessionKey);
DecryptVerifyResult decryptVerifyResult = builder.build().execute();
@@ -364,6 +367,7 @@ public class KeychainIntentService extends IntentService implements Progressable
try {
/* Input */
String passphrase = data.getString(DECRYPT_PASSPHRASE);
byte[] nfcDecryptedSessionKey = data.getByteArray(DECRYPT_NFC_DECRYPTED_SESSION_KEY);
InputData inputData = createDecryptInputData(data);
@@ -380,7 +384,8 @@ public class KeychainIntentService extends IntentService implements Progressable
builder.setProgressable(this)
.setAllowSymmetricDecryption(true)
.setPassphrase(passphrase)
.setDecryptMetadataOnly(true);
.setDecryptMetadataOnly(true)
.setNfcState(nfcDecryptedSessionKey);
DecryptVerifyResult decryptVerifyResult = builder.build().execute();

View File

@@ -36,7 +36,7 @@ public class DecryptVerifyResult extends OperationResult {
long mKeyIdPassphraseNeeded;
byte[] mNfcSessionKey;
String mNfcPassphrase;
long mNfcKeyId;
OpenPgpSignatureResult mSignatureResult;
OpenPgpMetadata mDecryptMetadata;
@@ -49,17 +49,17 @@ public class DecryptVerifyResult extends OperationResult {
mKeyIdPassphraseNeeded = keyIdPassphraseNeeded;
}
public void setNfcState(byte[] sessionKey, String passphrase) {
public void setNfcState(byte[] sessionKey, long nfcKeyId) {
mNfcSessionKey = sessionKey;
mNfcPassphrase = passphrase;
mNfcKeyId = nfcKeyId;
}
public byte[] getNfcEncryptedSessionKey() {
return mNfcSessionKey;
}
public String getNfcPassphrase() {
return mNfcPassphrase;
public long getNfcKeyId() {
return mNfcKeyId;
}
public OpenPgpSignatureResult getSignatureResult() {
@@ -92,7 +92,6 @@ public class DecryptVerifyResult extends OperationResult {
mSignatureResult = source.readParcelable(OpenPgpSignatureResult.class.getClassLoader());
mDecryptMetadata = source.readParcelable(OpenPgpMetadata.class.getClassLoader());
mNfcSessionKey = source.readInt() != 0 ? source.createByteArray() : null;
mNfcPassphrase = source.readString();
}
public int describeContents() {
@@ -110,7 +109,6 @@ public class DecryptVerifyResult extends OperationResult {
} else {
dest.writeInt(0);
}
dest.writeString(mNfcPassphrase);
}
public static final Creator<DecryptVerifyResult> CREATOR = new Creator<DecryptVerifyResult>() {