mirror of
https://github.com/corda/corda.git
synced 2025-06-12 20:28:18 +00:00
ENT-4595 harmonize core and serialization (#5792)
* Harmonize serialization/core and deterministic counterparts * Fix test for changed private alias key behaviour * Detekt errors * roll back project.xml
This commit is contained in:
committed by
Rick Parker
parent
87b39bf515
commit
14050826e9
@ -2,7 +2,6 @@ package net.corda.nodeapi.internal.crypto
|
||||
|
||||
import net.corda.core.crypto.internal.AliasPrivateKey
|
||||
import net.corda.testing.internal.stubs.CertificateStoreStubs
|
||||
import org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
@ -20,15 +19,18 @@ class AliasPrivateKeyTest {
|
||||
val alias = "01234567890"
|
||||
val aliasPrivateKey = AliasPrivateKey(alias)
|
||||
val certificatesDirectory = tempFolder.root.toPath()
|
||||
val signingCertStore = CertificateStoreStubs.Signing.withCertificatesDirectory(certificatesDirectory, "keystorepass").get(createNew = true)
|
||||
signingCertStore.query { setPrivateKey(alias, aliasPrivateKey, listOf(NOT_YET_REGISTERED_MARKER_KEYS_AND_CERTS.ECDSAR1_CERT), "entrypassword") }
|
||||
val signingCertStore = CertificateStoreStubs.Signing.withCertificatesDirectory(
|
||||
certificatesDirectory,
|
||||
"keystorepass").get(createNew = true)
|
||||
signingCertStore.query {
|
||||
setPrivateKey(alias, aliasPrivateKey, listOf(NOT_YET_REGISTERED_MARKER_KEYS_AND_CERTS.ECDSAR1_CERT), "entrypassword")
|
||||
}
|
||||
// We can retrieve the certificate.
|
||||
assertTrue { signingCertStore.contains(alias) }
|
||||
// We can retrieve the certificate.
|
||||
assertEquals(NOT_YET_REGISTERED_MARKER_KEYS_AND_CERTS.ECDSAR1_CERT, signingCertStore[alias])
|
||||
// Although we can store an AliasPrivateKey, we cannot retrieve it. But, it's fine as we use certStore for storing/handling certs only.
|
||||
assertThatIllegalArgumentException().isThrownBy {
|
||||
signingCertStore.query { getPrivateKey(alias, "entrypassword") }
|
||||
}.withMessage("Unrecognised algorithm: 1.3.6.1.4.1.50530.1.2")
|
||||
// Although we can store an AliasPrivateKey, we cannot retrieve it. But, it's fine as we use certStore for storing/handling certs
|
||||
// only.
|
||||
assertEquals(aliasPrivateKey, signingCertStore.query { getPrivateKey(alias, "entrypassword") })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user