mirror of
https://github.com/corda/corda.git
synced 2025-06-12 20:28:18 +00:00
Merge pull request #6049 from corda/christians/ENT-4494-crypto-service
ENT-4494 Harmonize CryptoService
This commit is contained in:
@ -61,11 +61,6 @@ interface CryptoService : SignOnlyCryptoService {
|
||||
*/
|
||||
fun generateKeyPair(alias: String, scheme: SignatureScheme): PublicKey
|
||||
|
||||
/**
|
||||
* Returns the type of the service.
|
||||
*/
|
||||
fun getType(): SupportedCryptoServices
|
||||
|
||||
|
||||
// ******************************************************
|
||||
// ENTERPRISE ONLY CODE FOR WRAPPING KEYS API STARTS HERE
|
||||
|
@ -1,21 +0,0 @@
|
||||
package net.corda.nodeapi.internal.cryptoservice
|
||||
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.nodeapi.internal.config.FileBasedCertificateStoreSupplier
|
||||
import net.corda.nodeapi.internal.cryptoservice.bouncycastle.BCCryptoService
|
||||
|
||||
class CryptoServiceFactory {
|
||||
companion object {
|
||||
fun makeCryptoService(
|
||||
cryptoServiceName: SupportedCryptoServices,
|
||||
legalName: CordaX500Name,
|
||||
signingCertificateStore: FileBasedCertificateStoreSupplier? = null
|
||||
): CryptoService {
|
||||
// The signing certificate store can be null for other services as only BCC requires is at the moment.
|
||||
if (cryptoServiceName != SupportedCryptoServices.BC_SIMPLE || signingCertificateStore == null) {
|
||||
throw IllegalArgumentException("Currently only BouncyCastle is used as a crypto service. A valid signing certificate store is required.")
|
||||
}
|
||||
return BCCryptoService(legalName.x500Principal, signingCertificateStore)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package net.corda.nodeapi.internal.cryptoservice
|
||||
|
||||
enum class SupportedCryptoServices(val userFriendlyName: String) {
|
||||
/** Identifier for [BCCryptoService]. */
|
||||
BC_SIMPLE("file-based keystore")
|
||||
}
|
@ -17,7 +17,6 @@ import net.corda.nodeapi.internal.crypto.save
|
||||
import net.corda.nodeapi.internal.cryptoservice.*
|
||||
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.nio.file.Path
|
||||
import java.security.*
|
||||
@ -41,8 +40,6 @@ class BCCryptoService(private val legalName: X500Principal,
|
||||
val detailedLogger = detailedLogger()
|
||||
}
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user