whitelist sec and brainpool curves
This commit is contained in:
@@ -18,10 +18,12 @@
|
|||||||
package org.sufficientlysecure.keychain.pgp;
|
package org.sufficientlysecure.keychain.pgp;
|
||||||
|
|
||||||
import org.bouncycastle.asn1.nist.NISTNamedCurves;
|
import org.bouncycastle.asn1.nist.NISTNamedCurves;
|
||||||
|
import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||||
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
|
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
|
||||||
import org.bouncycastle.bcpg.HashAlgorithmTags;
|
import org.bouncycastle.bcpg.HashAlgorithmTags;
|
||||||
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
||||||
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
|
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
|
||||||
|
import org.bouncycastle.crypto.ec.CustomNamedCurves;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -108,7 +110,11 @@ public class PgpSecurityConstants {
|
|||||||
private static HashSet<String> sCurveWhitelist = new HashSet<>(Arrays.asList(
|
private static HashSet<String> sCurveWhitelist = new HashSet<>(Arrays.asList(
|
||||||
NISTNamedCurves.getOID("P-256").getId(),
|
NISTNamedCurves.getOID("P-256").getId(),
|
||||||
NISTNamedCurves.getOID("P-384").getId(),
|
NISTNamedCurves.getOID("P-384").getId(),
|
||||||
NISTNamedCurves.getOID("P-521").getId()
|
NISTNamedCurves.getOID("P-521").getId(),
|
||||||
|
CustomNamedCurves.getOID("secp256k1").getId(),
|
||||||
|
TeleTrusTNamedCurves.getOID("brainpoolP256r1").getId(),
|
||||||
|
TeleTrusTNamedCurves.getOID("brainpoolP384r1").getId(),
|
||||||
|
TeleTrusTNamedCurves.getOID("brainpoolP512r1").getId()
|
||||||
));
|
));
|
||||||
|
|
||||||
public static boolean isSecureKey(CanonicalizedPublicKey key) {
|
public static boolean isSecureKey(CanonicalizedPublicKey key) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.bouncycastle.asn1.ASN1ObjectIdentifier;
|
|||||||
import org.bouncycastle.asn1.nist.NISTNamedCurves;
|
import org.bouncycastle.asn1.nist.NISTNamedCurves;
|
||||||
import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||||
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
||||||
|
import org.bouncycastle.crypto.ec.CustomNamedCurves;
|
||||||
import org.bouncycastle.util.encoders.Hex;
|
import org.bouncycastle.util.encoders.Hex;
|
||||||
import org.openintents.openpgp.OpenPgpDecryptionResult;
|
import org.openintents.openpgp.OpenPgpDecryptionResult;
|
||||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||||
@@ -210,6 +211,10 @@ public class KeyFormattingUtils {
|
|||||||
if (name != null) {
|
if (name != null) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
name = CustomNamedCurves.getName(oid);
|
||||||
|
if (name != null) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
return context.getResources().getString(R.string.unknown);
|
return context.getResources().getString(R.string.unknown);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user