mirror of
https://github.com/corda/corda.git
synced 2025-01-18 02:39:51 +00:00
Merge pull request #6100 from corda/denis/ENT-4659-remove-crypto-service-factory
ENT-4659: Remove CryptoServiceFactory from OS
This commit is contained in:
commit
f1c14edd00
@ -150,8 +150,7 @@ import net.corda.nodeapi.internal.crypto.X509Utilities.DEFAULT_VALIDITY_WINDOW
|
||||
import net.corda.nodeapi.internal.crypto.X509Utilities.DISTRIBUTED_NOTARY_COMPOSITE_KEY_ALIAS
|
||||
import net.corda.nodeapi.internal.crypto.X509Utilities.DISTRIBUTED_NOTARY_KEY_ALIAS
|
||||
import net.corda.nodeapi.internal.crypto.X509Utilities.NODE_IDENTITY_KEY_ALIAS
|
||||
import net.corda.node.utilities.cryptoservice.CryptoServiceFactory
|
||||
import net.corda.node.utilities.cryptoservice.SupportedCryptoServices
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoService
|
||||
import net.corda.nodeapi.internal.cryptoservice.bouncycastle.BCCryptoService
|
||||
import net.corda.nodeapi.internal.lifecycle.NodeLifecycleEvent
|
||||
import net.corda.nodeapi.internal.lifecycle.NodeLifecycleEventsDistributor
|
||||
@ -266,11 +265,8 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
||||
configuration.devMode
|
||||
).tokenize()
|
||||
val attachmentTrustCalculator = makeAttachmentTrustCalculator(configuration, database)
|
||||
val cryptoService = CryptoServiceFactory.makeCryptoService(
|
||||
SupportedCryptoServices.BC_SIMPLE,
|
||||
configuration.myLegalName,
|
||||
configuration.signingCertificateStore
|
||||
)
|
||||
@Suppress("LeakingThis")
|
||||
val cryptoService = makeCryptoService()
|
||||
@Suppress("LeakingThis")
|
||||
val networkParametersStorage = makeNetworkParametersStorage()
|
||||
val cordappProvider = CordappProviderImpl(cordappLoader, CordappConfigFileProvider(configuration.cordappDirectories), attachments).tokenize()
|
||||
@ -880,6 +876,10 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
||||
return DBNetworkParametersStorage(cacheFactory, database, networkMapClient).tokenize()
|
||||
}
|
||||
|
||||
protected open fun makeCryptoService(): CryptoService {
|
||||
return BCCryptoService(configuration.myLegalName.x500Principal, configuration.signingCertificateStore)
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected open fun acceptableLiveFiberCountOnStop(): Int = 0
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
package net.corda.node.utilities.cryptoservice
|
||||
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.nodeapi.internal.config.FileBasedCertificateStoreSupplier
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoService
|
||||
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.node.utilities.cryptoservice
|
||||
|
||||
enum class SupportedCryptoServices(val userFriendlyName: String) {
|
||||
/** Identifier for [BCCryptoService]. */
|
||||
BC_SIMPLE("file-based keystore")
|
||||
}
|
@ -18,8 +18,6 @@ import net.corda.nodeapi.internal.crypto.X509Utilities.CORDA_CLIENT_TLS
|
||||
import net.corda.nodeapi.internal.crypto.X509Utilities.CORDA_ROOT_CA
|
||||
import net.corda.nodeapi.internal.crypto.X509Utilities.DEFAULT_VALIDITY_WINDOW
|
||||
import net.corda.nodeapi.internal.cryptoservice.CryptoService
|
||||
import net.corda.node.utilities.cryptoservice.CryptoServiceFactory
|
||||
import net.corda.node.utilities.cryptoservice.SupportedCryptoServices
|
||||
import net.corda.nodeapi.internal.cryptoservice.bouncycastle.BCCryptoService
|
||||
import org.bouncycastle.asn1.x500.X500Name
|
||||
import org.bouncycastle.openssl.jcajce.JcaPEMWriter
|
||||
@ -288,7 +286,7 @@ class NodeRegistrationConfiguration(
|
||||
tlsCertCrlDistPoint = config.tlsCertCrlDistPoint,
|
||||
certificatesDirectory = config.certificatesDirectory,
|
||||
emailAddress = config.emailAddress,
|
||||
cryptoService = CryptoServiceFactory.makeCryptoService(SupportedCryptoServices.BC_SIMPLE, config.myLegalName, config.signingCertificateStore),
|
||||
cryptoService = BCCryptoService(config.myLegalName.x500Principal, config.signingCertificateStore),
|
||||
certificateStore = config.signingCertificateStore.get(true)
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user