From 3cb9f87c544edbfb3186f001c25a7de7f68523fe Mon Sep 17 00:00:00 2001 From: Jill Kleiber Date: Mon, 4 Mar 2024 11:46:15 +0100 Subject: [PATCH 1/2] pr-1567: Fix bug in createCompressed() --- .../oer/its/ieee1609dot2/basetypes/EccP256CurvePoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/src/main/java/org/bouncycastle/oer/its/ieee1609dot2/basetypes/EccP256CurvePoint.java b/util/src/main/java/org/bouncycastle/oer/its/ieee1609dot2/basetypes/EccP256CurvePoint.java index 9dcdc6dd31..fa6e4205e4 100644 --- a/util/src/main/java/org/bouncycastle/oer/its/ieee1609dot2/basetypes/EccP256CurvePoint.java +++ b/util/src/main/java/org/bouncycastle/oer/its/ieee1609dot2/basetypes/EccP256CurvePoint.java @@ -165,7 +165,7 @@ else if (encoded[0] == 0x03) choice = compressedY1; } byte[] copy = new byte[encoded.length - 1]; - System.arraycopy(encoded, 0, copy, 0, copy.length); + System.arraycopy(encoded, 1, copy, 0, copy.length); return new EccP256CurvePoint(choice, new DEROctetString(copy)); } From feb8b6c849c9d265ed2220bf8e1a4a015f358cfc Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 4 Mar 2024 20:46:53 +0700 Subject: [PATCH 2/2] Move some OID mappings around --- .../org/bouncycastle/jcajce/provider/asymmetric/EC.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/EC.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/EC.java index c51a0d4e76..d9e4f8e465 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/EC.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/EC.java @@ -108,8 +108,8 @@ public void configure(ConfigurableProvider provider) registerOid(provider, X9ObjectIdentifiers.id_ecPublicKey, "EC", new KeyFactorySpi.EC()); + registerOid(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC", new KeyFactorySpi.EC()); registerOid(provider, X9ObjectIdentifiers.dhSinglePass_cofactorDH_sha1kdf_scheme, "EC", new KeyFactorySpi.EC()); - registerOid(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); registerOid(provider, SECObjectIdentifiers.dhSinglePass_stdDH_sha224kdf_scheme, "EC", new KeyFactorySpi.EC()); registerOid(provider, SECObjectIdentifiers.dhSinglePass_cofactorDH_sha224kdf_scheme, "EC", new KeyFactorySpi.EC()); @@ -162,14 +162,14 @@ public void configure(ConfigurableProvider provider) provider.addAlgorithm("KeyAgreement." + SECObjectIdentifiers.mqvSinglePass_sha384kdf_scheme, PREFIX + "KeyAgreementSpi$MQVwithSHA384KDFAndSharedInfo", generalEcAttributes); provider.addAlgorithm("KeyAgreement." + SECObjectIdentifiers.mqvSinglePass_sha512kdf_scheme, PREFIX + "KeyAgreementSpi$MQVwithSHA512KDFAndSharedInfo", generalEcAttributes); - registerOid(provider, X9ObjectIdentifiers.dhSinglePass_stdDH_sha1kdf_scheme, "EC", new KeyFactorySpi.EC()); + registerOid(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); registerOidAlgorithmParameters(provider, X9ObjectIdentifiers.mqvSinglePass_sha1kdf_scheme, "EC"); registerOid(provider, SECObjectIdentifiers.mqvSinglePass_sha224kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); - registerOidAlgorithmParameters(provider, SECObjectIdentifiers.mqvSinglePass_sha256kdf_scheme, "EC"); + registerOidAlgorithmParameters(provider, SECObjectIdentifiers.mqvSinglePass_sha224kdf_scheme, "EC"); registerOid(provider, SECObjectIdentifiers.mqvSinglePass_sha256kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); - registerOidAlgorithmParameters(provider, SECObjectIdentifiers.mqvSinglePass_sha224kdf_scheme, "EC"); + registerOidAlgorithmParameters(provider, SECObjectIdentifiers.mqvSinglePass_sha256kdf_scheme, "EC"); registerOid(provider, SECObjectIdentifiers.mqvSinglePass_sha384kdf_scheme, "ECMQV", new KeyFactorySpi.ECMQV()); registerOidAlgorithmParameters(provider, SECObjectIdentifiers.mqvSinglePass_sha384kdf_scheme, "EC");