mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
ENT-3642: move the crypto service builder method to node-api (#5198)
* ENT-3642: move the crypto service builder method to node-api * ENT-3642: add arg for different crypto services * ENT-3642: add arg for cryptoservice config * ENT-3642: add null check for BCC requirement * ENT-3642: remove double-bang operator * ENT-3642: cryptoservice factory method moved to its own class, improve API * ENT-3642: remove import
This commit is contained in:
committed by
Matthew Nesbit
parent
603da3eeff
commit
726798cce8
@ -0,0 +1,18 @@
|
||||
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
|
||||
import java.nio.file.Path
|
||||
|
||||
class CryptoServiceFactory {
|
||||
companion object {
|
||||
fun makeCryptoService(cryptoServiceName: SupportedCryptoServices, legalName: CordaX500Name, signingCertificateStore: FileBasedCertificateStoreSupplier? = null, cryptoServiceConf: Path? = 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)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user