mirror of
https://github.com/corda/corda.git
synced 2025-02-20 09:26:41 +00:00
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:
parent
3dc60aa83f
commit
04963e7f67
@ -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,
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user