mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
[NOTICK] Expose type in CryptoService (#5416)
This commit is contained in:
parent
07b96aea18
commit
3023e3ab87
@ -59,6 +59,11 @@ interface CryptoService : SignOnlyCryptoService {
|
||||
* Returns the [PublicKey] of the generated [KeyPair].
|
||||
*/
|
||||
fun generateKeyPair(alias: String, scheme: SignatureScheme): PublicKey
|
||||
|
||||
/**
|
||||
* Returns the type of the service.
|
||||
*/
|
||||
fun getType(): SupportedCryptoServices
|
||||
}
|
||||
|
||||
open class CryptoServiceException(message: String?, cause: Throwable? = null) : Exception(message, cause)
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.corda.nodeapi.internal.cryptoservice
|
||||
|
||||
enum class SupportedCryptoServices {
|
||||
enum class SupportedCryptoServices(val userFriendlyName: String) {
|
||||
/** Identifier for [BCCryptoService]. */
|
||||
BC_SIMPLE
|
||||
// UTIMACO, // Utimaco HSM.
|
||||
// GEMALTO_LUNA, // Gemalto Luna HSM.
|
||||
// AZURE_KV // Azure key Vault.
|
||||
BC_SIMPLE("file-based keystore")
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import net.corda.nodeapi.internal.crypto.ContentSignerBuilder
|
||||
import net.corda.nodeapi.internal.crypto.X509Utilities
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoService
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoServiceException
|
||||
import net.corda.nodeapi.internal.cryptoservice.SupportedCryptoServices
|
||||
import org.bouncycastle.operator.ContentSigner
|
||||
import java.security.KeyPair
|
||||
import java.security.KeyStore
|
||||
@ -25,6 +26,8 @@ import javax.security.auth.x500.X500Principal
|
||||
*/
|
||||
class BCCryptoService(private val legalName: X500Principal, private val certificateStoreSupplier: CertificateStoreSupplier) : CryptoService {
|
||||
|
||||
override fun getType(): SupportedCryptoServices = SupportedCryptoServices.BC_SIMPLE
|
||||
|
||||
// TODO check if keyStore exists.
|
||||
// TODO make it private when E2ETestKeyManagementService does not require direct access to the private key.
|
||||
var certificateStore: CertificateStore = certificateStoreSupplier.get(true)
|
||||
|
@ -8,6 +8,7 @@ import net.corda.core.crypto.sha256
|
||||
import net.corda.nodeapi.internal.crypto.ContentSignerBuilder
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoService
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoServiceException
|
||||
import net.corda.nodeapi.internal.cryptoservice.SupportedCryptoServices
|
||||
import org.bouncycastle.operator.ContentSigner
|
||||
import java.security.KeyPair
|
||||
import java.security.PublicKey
|
||||
@ -15,6 +16,8 @@ import java.security.Signature
|
||||
|
||||
class MockCryptoService(initialKeyPairs: Map<String, KeyPair>) : CryptoService {
|
||||
|
||||
override fun getType(): SupportedCryptoServices = SupportedCryptoServices.BC_SIMPLE
|
||||
|
||||
private val aliasToKey: MutableMap<String, KeyPair> = mutableMapOf()
|
||||
|
||||
init {
|
||||
|
Loading…
Reference in New Issue
Block a user