aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java5
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java22
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java26
m---------extern/openpgp-api-lib0
4 files changed, 29 insertions, 24 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java
index 8076a14f3..0d3e5676a 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java
@@ -24,6 +24,7 @@ import org.sufficientlysecure.keychain.util.IterableIterator;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.ArrayList;
/** A generic wrapped PGPKeyRing object.
*
@@ -58,6 +59,10 @@ public abstract class CanonicalizedKeyRing extends KeyRing {
return getPublicKey().getPrimaryUserIdWithFallback();
}
+ public ArrayList<String> getUnorderedUserIds() {
+ return getPublicKey().getUnorderedUserIds();
+ }
+
public boolean isRevoked() throws PgpGeneralException {
// Is the master key revoked?
return getRing().getPublicKey().isRevoked();
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java
index ab88d1b4b..3d41c928b 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java
@@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.pgp;
import org.openintents.openpgp.OpenPgpSignatureResult;
import org.sufficientlysecure.keychain.Constants;
+import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.util.Log;
import java.util.ArrayList;
@@ -86,6 +87,27 @@ public class OpenPgpSignatureResultBuilder {
return mValidSignature;
}
+ public void initValid(CanonicalizedPublicKeyRing signingRing,
+ CanonicalizedPublicKey signingKey) {
+ setSignatureAvailable(true);
+ setKnownKey(true);
+
+ // from RING
+ setKeyId(signingRing.getMasterKeyId());
+ try {
+ setPrimaryUserId(signingRing.getPrimaryUserIdWithFallback());
+ } catch (PgpGeneralException e) {
+ Log.d(Constants.TAG, "No primary user id in keyring with master key id " + signingRing.getMasterKeyId());
+ }
+ setSignatureKeyCertified(signingRing.getVerified() > 0);
+ Log.d(Constants.TAG, "signingRing.getUnorderedUserIds(): " + signingRing.getUnorderedUserIds());
+ setUserIds(signingRing.getUnorderedUserIds());
+
+ // from KEY
+ setKeyExpired(signingKey.isExpired());
+ setKeyRevoked(signingKey.isRevoked());
+ }
+
public OpenPgpSignatureResult build() {
if (mSignatureAvailable) {
OpenPgpSignatureResult result = new OpenPgpSignatureResult();
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
index e7bb6d7b1..cb077c55c 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
@@ -421,18 +421,7 @@ public class PgpDecryptVerify {
// key found in our database!
signature = sigList.get(signatureIndex);
- signatureResultBuilder.setSignatureAvailable(true);
- signatureResultBuilder.setKnownKey(true);
- signatureResultBuilder.setKeyId(signingRing.getMasterKeyId());
- try {
- signatureResultBuilder.setPrimaryUserId(signingRing.getPrimaryUserIdWithFallback());
- } catch (PgpGeneralException e) {
- Log.d(Constants.TAG, "No primary user id in keyring with master key id " + signingRing.getMasterKeyId());
- }
- signatureResultBuilder.setSignatureKeyCertified(signingRing.getVerified() > 0);
- signatureResultBuilder.setKeyExpired(signingKey.isExpired());
- signatureResultBuilder.setKeyRevoked(signingKey.isRevoked());
- signatureResultBuilder.setUserIds(signingKey.getUnorderedUserIds());
+ signatureResultBuilder.initValid(signingRing, signingKey);
JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider =
new JcaPGPContentVerifierBuilderProvider()
@@ -658,18 +647,7 @@ public class PgpDecryptVerify {
// key found in our database!
signature = sigList.get(signatureIndex);
- signatureResultBuilder.setSignatureAvailable(true);
- signatureResultBuilder.setKnownKey(true);
- signatureResultBuilder.setKeyId(signingRing.getMasterKeyId());
- try {
- signatureResultBuilder.setPrimaryUserId(signingRing.getPrimaryUserIdWithFallback());
- } catch (PgpGeneralException e) {
- Log.d(Constants.TAG, "No primary user id in key with master key id " + signingRing.getMasterKeyId());
- }
- signatureResultBuilder.setSignatureKeyCertified(signingRing.getVerified() > 0);
- signatureResultBuilder.setKeyExpired(signingKey.isExpired());
- signatureResultBuilder.setKeyRevoked(signingKey.isRevoked());
- signatureResultBuilder.setUserIds(signingKey.getUnorderedUserIds());
+ signatureResultBuilder.initValid(signingRing, signingKey);
JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider =
new JcaPGPContentVerifierBuilderProvider()
diff --git a/extern/openpgp-api-lib b/extern/openpgp-api-lib
-Subproject ac927df10abfd73b48d5971dee91e6d1bfc144b
+Subproject 2cebac6a23e55627131947ba4d515c781fb5d31