diff --git a/src/com/amazon/corretto/crypto/provider/AmazonCorrettoCryptoProvider.java b/src/com/amazon/corretto/crypto/provider/AmazonCorrettoCryptoProvider.java index 5c5e383e..610774b5 100644 --- a/src/com/amazon/corretto/crypto/provider/AmazonCorrettoCryptoProvider.java +++ b/src/com/amazon/corretto/crypto/provider/AmazonCorrettoCryptoProvider.java @@ -10,9 +10,9 @@ import static com.amazon.corretto.crypto.provider.ConcatenationKdfSpi.CKDF_WITH_SHA256; import static com.amazon.corretto.crypto.provider.ConcatenationKdfSpi.CKDF_WITH_SHA384; import static com.amazon.corretto.crypto.provider.ConcatenationKdfSpi.CKDF_WITH_SHA512; -import static com.amazon.corretto.crypto.provider.CounterKdfSpi.CNTRKDF_WITH_SHA256; -import static com.amazon.corretto.crypto.provider.CounterKdfSpi.CNTRKDF_WITH_SHA384; -import static com.amazon.corretto.crypto.provider.CounterKdfSpi.CNTRKDF_WITH_SHA512; +import static com.amazon.corretto.crypto.provider.CounterKdfSpi.CTR_KDF_WITH_HMAC_SHA256; +import static com.amazon.corretto.crypto.provider.CounterKdfSpi.CTR_KDF_WITH_HMAC_SHA384; +import static com.amazon.corretto.crypto.provider.CounterKdfSpi.CTR_KDF_WITH_HMAC_SHA512; import static com.amazon.corretto.crypto.provider.HkdfSecretKeyFactorySpi.HKDF_WITH_SHA1; import static com.amazon.corretto.crypto.provider.HkdfSecretKeyFactorySpi.HKDF_WITH_SHA256; import static com.amazon.corretto.crypto.provider.HkdfSecretKeyFactorySpi.HKDF_WITH_SHA384; @@ -105,9 +105,9 @@ private void buildServiceMap() { addService("SecretKeyFactory", CKDF_WITH_HMAC_SHA512, concatenationKdfSpi, false); final String counterKdfSpi = "CounterKdfSpi"; - addService("SecretKeyFactory", CNTRKDF_WITH_SHA256, counterKdfSpi, false); - addService("SecretKeyFactory", CNTRKDF_WITH_SHA384, counterKdfSpi, false); - addService("SecretKeyFactory", CNTRKDF_WITH_SHA512, counterKdfSpi, false); + addService("SecretKeyFactory", CTR_KDF_WITH_HMAC_SHA256, counterKdfSpi, false); + addService("SecretKeyFactory", CTR_KDF_WITH_HMAC_SHA384, counterKdfSpi, false); + addService("SecretKeyFactory", CTR_KDF_WITH_HMAC_SHA512, counterKdfSpi, false); } addService("KeyPairGenerator", "RSA", "RsaGen"); diff --git a/src/com/amazon/corretto/crypto/provider/CounterKdfSpi.java b/src/com/amazon/corretto/crypto/provider/CounterKdfSpi.java index 7748df1e..79dab28a 100644 --- a/src/com/amazon/corretto/crypto/provider/CounterKdfSpi.java +++ b/src/com/amazon/corretto/crypto/provider/CounterKdfSpi.java @@ -46,17 +46,18 @@ private static native void nKdf( static final Map INSTANCES = getInstances(); - private static final String CNTR_KDF = "CounterKdf"; - private static final String WITH_HMAC = "WithHmac"; - static final String CNTRKDF_WITH_SHA256 = CNTR_KDF + WITH_HMAC + "SHA256"; - static final String CNTRKDF_WITH_SHA384 = CNTR_KDF + WITH_HMAC + "SHA384"; - static final String CNTRKDF_WITH_SHA512 = CNTR_KDF + WITH_HMAC + "SHA512"; + static final String CTR_KDF_WITH_HMAC_SHA256 = "CounterKdfWithHmacSHA256"; + static final String CTR_KDF_WITH_HMAC_SHA384 = "CounterKdfWithHmacSHA384"; + static final String CTR_KDF_WITH_HMAC_SHA512 = "CounterKdfWithHmacSHA512"; private static Map getInstances() { final Map kdfs = new HashMap<>(); - kdfs.put(getSpiFactoryForAlgName(CNTRKDF_WITH_SHA256), new CounterKdfSpi(Utils.SHA256_CODE)); - kdfs.put(getSpiFactoryForAlgName(CNTRKDF_WITH_SHA384), new CounterKdfSpi(Utils.SHA384_CODE)); - kdfs.put(getSpiFactoryForAlgName(CNTRKDF_WITH_SHA512), new CounterKdfSpi(Utils.SHA512_CODE)); + kdfs.put( + getSpiFactoryForAlgName(CTR_KDF_WITH_HMAC_SHA256), new CounterKdfSpi(Utils.SHA256_CODE)); + kdfs.put( + getSpiFactoryForAlgName(CTR_KDF_WITH_HMAC_SHA384), new CounterKdfSpi(Utils.SHA384_CODE)); + kdfs.put( + getSpiFactoryForAlgName(CTR_KDF_WITH_HMAC_SHA512), new CounterKdfSpi(Utils.SHA512_CODE)); return Collections.unmodifiableMap(kdfs); }