From 706e60474d15f833ad5ead519518775812978bac Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 28 Sep 2014 14:25:54 +0200 Subject: be more mindful of algorithm and usage flag interaction Fixes #895 --- .../keychain/pgp/UncachedPublicKey.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedPublicKey.java') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedPublicKey.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedPublicKey.java index 7f08d121e..74af9fc97 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedPublicKey.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedPublicKey.java @@ -18,9 +18,6 @@ package org.sufficientlysecure.keychain.pgp; -import org.spongycastle.asn1.ASN1ObjectIdentifier; -import org.spongycastle.asn1.nist.NISTNamedCurves; -import org.spongycastle.asn1.teletrust.TeleTrusTNamedCurves; import org.spongycastle.bcpg.ECPublicBCPGKey; import org.spongycastle.bcpg.SignatureSubpacketTags; import org.spongycastle.bcpg.sig.KeyFlags; @@ -28,7 +25,6 @@ import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPSignature; import org.spongycastle.openpgp.PGPSignatureSubpacketVector; import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider; -import org.spongycastle.util.Strings; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.util.IterableIterator; import org.sufficientlysecure.keychain.util.Log; @@ -264,12 +260,6 @@ public class UncachedPublicKey { return (getKeyUsage() & KeyFlags.CERTIFY_OTHER) != 0; } - if (mPublicKey.getAlgorithm() == PGPPublicKey.RSA_GENERAL - || mPublicKey.getAlgorithm() == PGPPublicKey.RSA_SIGN - || mPublicKey.getAlgorithm() == PGPPublicKey.ECDSA) { - return true; - } - return false; } @@ -279,9 +269,7 @@ public class UncachedPublicKey { return (getKeyUsage() & KeyFlags.SIGN_DATA) != 0; } - if (mPublicKey.getAlgorithm() == PGPPublicKey.RSA_GENERAL - || mPublicKey.getAlgorithm() == PGPPublicKey.RSA_SIGN - || mPublicKey.getAlgorithm() == PGPPublicKey.ECDSA) { + if (UncachedKeyRing.isSigningAlgo(mPublicKey.getAlgorithm())) { return true; } @@ -295,7 +283,7 @@ public class UncachedPublicKey { } // RSA_GENERAL, RSA_ENCRYPT, ELGAMAL_ENCRYPT, ELGAMAL_GENERAL, ECDH - if (mPublicKey.isEncryptionKey()) { + if (UncachedKeyRing.isEncryptionAlgo(mPublicKey.getAlgorithm())) { return true; } -- cgit v1.2.3