aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-03-20 13:38:07 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-03-20 13:38:07 +0100
commit9e668eadcb5dc5737f3df94339a1fa1e8662f0ea (patch)
tree6385b691751e20295854e574fe2558493719dd15
parent10510288f13a89b0f69994b9d2962c4d26b5f017 (diff)
downloadopen-keychain-9e668eadcb5dc5737f3df94339a1fa1e8662f0ea.tar.gz
open-keychain-9e668eadcb5dc5737f3df94339a1fa1e8662f0ea.tar.bz2
open-keychain-9e668eadcb5dc5737f3df94339a1fa1e8662f0ea.zip
Fix PASSPHRASE handling in API
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java20
m---------extern/openpgp-api-lib0
2 files changed, 18 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
index 98a9ff44f..4707a2ad5 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -240,6 +240,11 @@ public class OpenPgpService extends RemoteService {
try {
boolean asciiArmor = cleartextSign || data.getBooleanExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
+ Passphrase passphrase = null;
+ if (data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE) != null) {
+ passphrase = new Passphrase(data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE));
+ }
+
byte[] nfcSignedHash = data.getByteArrayExtra(OpenPgpApi.EXTRA_NFC_SIGNED_HASH);
if (nfcSignedHash != null) {
Log.d(Constants.TAG, "nfcSignedHash:" + Hex.toHexString(nfcSignedHash));
@@ -278,6 +283,7 @@ public class OpenPgpService extends RemoteService {
// sign-only
PgpSignEncryptInput pseInput = new PgpSignEncryptInput()
+ .setSignaturePassphrase(passphrase)
.setEnableAsciiArmorOutput(asciiArmor)
.setCleartextSignature(cleartextSign)
.setDetachedSignature(!cleartextSign)
@@ -366,6 +372,11 @@ public class OpenPgpService extends RemoteService {
compressionId = CompressionAlgorithmTags.UNCOMPRESSED;
}
+ Passphrase passphrase = null;
+ if (data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE) != null) {
+ passphrase = new Passphrase(data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE));
+ }
+
// first try to get key ids from non-ambiguous key id extra
long[] keyIds = data.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);
if (keyIds == null) {
@@ -391,7 +402,8 @@ public class OpenPgpService extends RemoteService {
InputData inputData = new InputData(is, inputLength, originalFilename);
PgpSignEncryptInput pseInput = new PgpSignEncryptInput();
- pseInput.setEnableAsciiArmorOutput(asciiArmor)
+ pseInput.setSignaturePassphrase(passphrase)
+ .setEnableAsciiArmorOutput(asciiArmor)
.setVersionHeader(null)
.setCompressionId(compressionId)
.setSymmetricEncryptionAlgorithm(PgpConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_PREFERRED)
@@ -499,6 +511,11 @@ public class OpenPgpService extends RemoteService {
os = new ParcelFileDescriptor.AutoCloseOutputStream(output);
}
+ Passphrase passphrase = null;
+ if (data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE) != null) {
+ passphrase = new Passphrase(data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE));
+ }
+
String currentPkg = getCurrentCallingPackage();
Set<Long> allowedKeyIds;
if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) < 7) {
@@ -509,7 +526,6 @@ public class OpenPgpService extends RemoteService {
KeychainContract.ApiAllowedKeys.buildBaseUri(currentPkg));
}
- Passphrase passphrase = data.getParcelableExtra(OpenPgpApi.EXTRA_PASSPHRASE);
long inputLength = is.available();
InputData inputData = new InputData(is, inputLength);
diff --git a/extern/openpgp-api-lib b/extern/openpgp-api-lib
-Subproject d10df1d40f23475445d0abca217683e911ffa0a
+Subproject 34ccf4df41a30cb586f06eb3b9bc90efc8dd7a2