aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2013-09-06 18:36:16 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2013-09-06 18:36:16 +0200
commitd6dd81d4449f437de672395b8f9ba2664c945d4c (patch)
tree22b8e3531e3c4305aa4ae010196917f40003bd8c /OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java
parent9e8ee3353a8230c02a0c5cc63448c16164149b24 (diff)
downloadopen-keychain-d6dd81d4449f437de672395b8f9ba2664c945d4c.tar.gz
open-keychain-d6dd81d4449f437de672395b8f9ba2664c945d4c.tar.bz2
open-keychain-d6dd81d4449f437de672395b8f9ba2664c945d4c.zip
Work on encryption in new service
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java')
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java
index 61627ffd8..e1bd415be 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpMain.java
@@ -735,13 +735,14 @@ public class PgpMain {
*/
public static void encryptAndSign(Context context, ProgressDialogUpdater progress,
InputData data, OutputStream outStream, boolean useAsciiArmor, int compression,
- long encryptionKeyIds[], String encryptionPassphrase, int symmetricEncryptionAlgorithm,
- long signatureKeyId, int signatureHashAlgorithm, boolean signatureForceV3,
- String signaturePassphrase) throws IOException, PgpGeneralException, PGPException,
- NoSuchProviderException, NoSuchAlgorithmException, SignatureException {
+ ArrayList<Long> encryptionKeyIds, String encryptionPassphrase,
+ int symmetricEncryptionAlgorithm, long signatureKeyId, int signatureHashAlgorithm,
+ boolean signatureForceV3, String signaturePassphrase) throws IOException,
+ PgpGeneralException, PGPException, NoSuchProviderException, NoSuchAlgorithmException,
+ SignatureException {
if (encryptionKeyIds == null) {
- encryptionKeyIds = new long[0];
+ encryptionKeyIds = new ArrayList<Long>();
}
ArmoredOutputStream armorOut = null;
@@ -758,7 +759,7 @@ public class PgpMain {
PGPSecretKeyRing signingKeyRing = null;
PGPPrivateKey signaturePrivateKey = null;
- if (encryptionKeyIds.length == 0 && encryptionPassphrase == null) {
+ if (encryptionKeyIds.size() == 0 && encryptionPassphrase == null) {
throw new PgpGeneralException(
context.getString(R.string.error_noEncryptionKeysOrPassPhrase));
}
@@ -794,7 +795,7 @@ public class PgpMain {
PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(encryptorBuilder);
- if (encryptionKeyIds.length == 0) {
+ if (encryptionKeyIds.size() == 0) {
// Symmetric encryption
Log.d(Constants.TAG, "encryptionKeyIds length is 0 -> symmetric encryption");
@@ -803,8 +804,8 @@ public class PgpMain {
cPk.addMethod(symmetricEncryptionGenerator);
} else {
// Asymmetric encryption
- for (int i = 0; i < encryptionKeyIds.length; ++i) {
- PGPPublicKey key = PgpHelper.getEncryptPublicKey(context, encryptionKeyIds[i]);
+ for (long id : encryptionKeyIds) {
+ PGPPublicKey key = PgpHelper.getEncryptPublicKey(context, id);
if (key != null) {
JcePublicKeyKeyEncryptionMethodGenerator pubKeyEncryptionGenerator = new JcePublicKeyKeyEncryptionMethodGenerator(