ENT-4494 Harmonize CryptoService interface/base class between OS and ENT, move OS BC implementation to node project.

This commit is contained in:
Christian Sailer 2020-03-10 12:36:30 +00:00
parent 68bb7a0e7b
commit ab6bf315c4
7 changed files with 7 additions and 17 deletions

View File

@ -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

View File

@ -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)

View File

@ -150,8 +150,8 @@ 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.nodeapi.internal.cryptoservice.CryptoServiceFactory
import net.corda.nodeapi.internal.cryptoservice.SupportedCryptoServices
import net.corda.node.utilities.cryptoservice.CryptoServiceFactory
import net.corda.node.utilities.cryptoservice.SupportedCryptoServices
import net.corda.nodeapi.internal.cryptoservice.bouncycastle.BCCryptoService
import net.corda.nodeapi.internal.lifecycle.NodeLifecycleEvent
import net.corda.nodeapi.internal.lifecycle.NodeLifecycleEventsDistributor

View File

@ -1,7 +1,8 @@
package net.corda.nodeapi.internal.cryptoservice
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 {

View File

@ -1,4 +1,4 @@
package net.corda.nodeapi.internal.cryptoservice
package net.corda.node.utilities.cryptoservice
enum class SupportedCryptoServices(val userFriendlyName: String) {
/** Identifier for [BCCryptoService]. */

View File

@ -18,8 +18,8 @@ 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.nodeapi.internal.cryptoservice.CryptoServiceFactory
import net.corda.nodeapi.internal.cryptoservice.SupportedCryptoServices
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

View File

@ -10,7 +10,6 @@ import net.corda.nodeapi.internal.crypto.ContentSignerBuilder
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.security.KeyPair
import java.security.PrivateKey
@ -22,8 +21,6 @@ import javax.crypto.SecretKey
class MockCryptoService(initialKeyPairs: Map<String, KeyPair>) : CryptoService {
override fun getType(): SupportedCryptoServices = SupportedCryptoServices.BC_SIMPLE
private val aliasToKey: MutableMap<String, KeyPair> = mutableMapOf()
private val wrappingKeys: MutableMap<String, SecretKey> = mutableMapOf()