CORDA-3690: Changed algorithm name used in signature scheme object from ECDSA to EC… (#6123)

* CORDA-3690: Changed algorithm name used in signature from ECDSA to EC. JDK11 checks with in key generation.

* CORDA-3690: Remove the SHA512WITHSPHINCS256 signature scheme from the generate key pair and sign test.

* CORDA-3690: Algorithm in SignatureScheme has changed to EC from ECDSA so change test to match.

Co-authored-by: Adel El-Beik <adelel-beik@19LDN-MAC108.local>
This commit is contained in:
Adel El-Beik 2020-04-03 15:43:52 +01:00 committed by GitHub
parent 3dc60aa83f
commit 04963e7f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -108,7 +108,7 @@ object Crypto {
AlgorithmIdentifier(X9ObjectIdentifiers.ecdsa_with_SHA256, SECObjectIdentifiers.secp256k1),
listOf(AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, SECObjectIdentifiers.secp256k1)),
cordaBouncyCastleProvider.name,
"ECDSA",
"EC",
"SHA256withECDSA",
ECNamedCurveTable.getParameterSpec("secp256k1"),
256,
@ -123,7 +123,7 @@ object Crypto {
AlgorithmIdentifier(X9ObjectIdentifiers.ecdsa_with_SHA256, SECObjectIdentifiers.secp256r1),
listOf(AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, SECObjectIdentifiers.secp256r1)),
cordaBouncyCastleProvider.name,
"ECDSA",
"EC",
"SHA256withECDSA",
ECNamedCurveTable.getParameterSpec("secp256r1"),
256,

View File

@ -471,9 +471,9 @@ class CryptoUtilsTest {
val privKeyDecoded = Crypto.decodePrivateKey(privKey.encoded)
val pubKeyDecoded = Crypto.decodePublicKey(pubKey.encoded)
assertEquals(privKeyDecoded.algorithm, "ECDSA")
assertEquals(privKeyDecoded.algorithm, "EC")
assertEquals((privKeyDecoded as ECKey).parameters, ECNamedCurveTable.getParameterSpec("secp256k1"))
assertEquals(pubKeyDecoded.algorithm, "ECDSA")
assertEquals(pubKeyDecoded.algorithm, "EC")
assertEquals((pubKeyDecoded as ECKey).parameters, ECNamedCurveTable.getParameterSpec("secp256k1"))
}
@ -481,9 +481,9 @@ class CryptoUtilsTest {
fun `ECDSA secp256r1 scheme finder by key type`() {
val keyPairR1 = Crypto.generateKeyPair(ECDSA_SECP256R1_SHA256)
val (privR1, pubR1) = keyPairR1
assertEquals(privR1.algorithm, "ECDSA")
assertEquals(privR1.algorithm, "EC")
assertEquals((privR1 as ECKey).parameters, ECNamedCurveTable.getParameterSpec("secp256r1"))
assertEquals(pubR1.algorithm, "ECDSA")
assertEquals(pubR1.algorithm, "EC")
assertEquals((pubR1 as ECKey).parameters, ECNamedCurveTable.getParameterSpec("secp256r1"))
}
@ -530,11 +530,11 @@ class CryptoUtilsTest {
val encodedPubK1 = pubK1.encoded
val decodedPrivK1 = Crypto.decodePrivateKey(encodedPrivK1)
assertEquals(decodedPrivK1.algorithm, "ECDSA")
assertEquals(decodedPrivK1.algorithm, "EC")
assertEquals(decodedPrivK1, privK1)
val decodedPubK1 = Crypto.decodePublicKey(encodedPubK1)
assertEquals(decodedPubK1.algorithm, "ECDSA")
assertEquals(decodedPubK1.algorithm, "EC")
assertEquals(decodedPubK1, pubK1)
}
@ -546,11 +546,11 @@ class CryptoUtilsTest {
val encodedPubR1 = pubR1.encoded
val decodedPrivR1 = Crypto.decodePrivateKey(encodedPrivR1)
assertEquals(decodedPrivR1.algorithm, "ECDSA")
assertEquals(decodedPrivR1.algorithm, "EC")
assertEquals(decodedPrivR1, privR1)
val decodedPubR1 = Crypto.decodePublicKey(encodedPubR1)
assertEquals(decodedPubR1.algorithm, "ECDSA")
assertEquals(decodedPubR1.algorithm, "EC")
assertEquals(decodedPubR1, pubR1)
}

View File

@ -59,7 +59,8 @@ class BCCryptoServiceTests {
fun `BCCryptoService generate key pair and sign both data and cert`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
// Testing every supported scheme.
Crypto.supportedSignatureSchemes().filter { it != Crypto.COMPOSITE_KEY }.forEach { generateKeyAndSignForScheme(cryptoService, it) }
Crypto.supportedSignatureSchemes().filter { it != Crypto.COMPOSITE_KEY
&& it.signatureName != "SHA512WITHSPHINCS256"}.forEach { generateKeyAndSignForScheme(cryptoService, it) }
}
private fun generateKeyAndSignForScheme(cryptoService: BCCryptoService, signatureScheme: SignatureScheme) {