mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Fix for user ids in API
This commit is contained in:
parent
cfe20d89ea
commit
bb0d04de82
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
|
2
extern/openpgp-api-lib
vendored
2
extern/openpgp-api-lib
vendored
@ -1 +1 @@
|
||||
Subproject commit ac927df10abfd73b48d5971dee91e6d1bfc144b2
|
||||
Subproject commit 2cebac6a23e55627131947ba4d515c781fb5d31c
|
Loading…
Reference in New Issue
Block a user