mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
Merge branch 'master' of https://github.com/corda/enterprise into christians_perftestflows
This commit is contained in:
commit
4ecc7e9ace
@ -9,8 +9,8 @@ import kotlin.test.assertFailsWith
|
||||
|
||||
class DoormanParametersTest {
|
||||
private val testDummyPath = ".${File.separator}testDummyPath.jks"
|
||||
private val validConfigPath = javaClass.getResource("/node.conf").path
|
||||
private val invalidConfigPath = javaClass.getResource("/node_fail.conf").path
|
||||
private val validConfigPath = File(javaClass.getResource("/node.conf").toURI()).absolutePath
|
||||
private val invalidConfigPath = File(javaClass.getResource("/node_fail.conf").toURI()).absolutePath
|
||||
|
||||
@Test
|
||||
fun `parse mode flag arg correctly`() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.corda.signing
|
||||
package com.r3.corda.signing
|
||||
|
||||
import net.corda.signing.configuration.Parameters
|
||||
import com.r3.corda.signing.configuration.Parameters
|
||||
import java.util.*
|
||||
import net.corda.signing.SigningServiceIntegrationTest.Companion.DB_NAME
|
||||
import net.corda.signing.SigningServiceIntegrationTest.Companion.HOST
|
||||
import net.corda.signing.SigningServiceIntegrationTest.Companion.H2_TCP_PORT
|
||||
import com.r3.corda.signing.SigningServiceIntegrationTest.Companion.DB_NAME
|
||||
import com.r3.corda.signing.SigningServiceIntegrationTest.Companion.HOST
|
||||
import com.r3.corda.signing.SigningServiceIntegrationTest.Companion.H2_TCP_PORT
|
||||
|
||||
/**
|
||||
* The main method for an interactive HSM signing service test/demo. It is supposed to be executed with the
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing
|
||||
package com.r3.corda.signing
|
||||
|
||||
import com.google.common.net.HostAndPort
|
||||
import com.nhaarman.mockito_kotlin.any
|
||||
@ -20,10 +20,10 @@ import net.corda.node.utilities.X509Utilities
|
||||
import net.corda.node.utilities.configureDatabase
|
||||
import net.corda.node.utilities.registration.HTTPNetworkRegistrationService
|
||||
import net.corda.node.utilities.registration.NetworkRegistrationHelper
|
||||
import net.corda.signing.hsm.HsmSigner
|
||||
import net.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import net.corda.signing.persistence.DBCertificateRequestStorage
|
||||
import net.corda.signing.persistence.SigningServerSchemaService
|
||||
import com.r3.corda.signing.hsm.HsmSigner
|
||||
import com.r3.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import com.r3.corda.signing.persistence.DBCertificateRequestStorage
|
||||
import com.r3.corda.signing.persistence.SigningServerSchemaService
|
||||
import net.corda.testing.ALICE
|
||||
import net.corda.testing.BOB
|
||||
import net.corda.testing.CHARLIE
|
||||
@ -37,7 +37,7 @@ import java.util.*
|
||||
import kotlin.concurrent.scheduleAtFixedRate
|
||||
import kotlin.concurrent.thread
|
||||
import com.r3.corda.doorman.persistence.DBCertificateRequestStorage.CertificateSigningRequest as DoormanRequest
|
||||
import net.corda.signing.persistence.DBCertificateRequestStorage.CertificateSigningRequest as SigningServerRequest
|
||||
import com.r3.corda.signing.persistence.DBCertificateRequestStorage.CertificateSigningRequest as SigningServerRequest
|
||||
|
||||
class SigningServiceIntegrationTest {
|
||||
|
@ -1,17 +1,17 @@
|
||||
package net.corda.signing
|
||||
package com.r3.corda.signing
|
||||
|
||||
import net.corda.node.utilities.configureDatabase
|
||||
import net.corda.signing.authentication.Authenticator
|
||||
import net.corda.signing.authentication.createProvider
|
||||
import net.corda.signing.configuration.Parameters
|
||||
import net.corda.signing.configuration.parseParameters
|
||||
import net.corda.signing.generator.KeyCertificateGenerator
|
||||
import net.corda.signing.hsm.HsmSigner
|
||||
import net.corda.signing.menu.Menu
|
||||
import net.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import net.corda.signing.persistence.DBCertificateRequestStorage
|
||||
import net.corda.signing.persistence.SigningServerSchemaService
|
||||
import net.corda.signing.utils.mapCryptoServerException
|
||||
import com.r3.corda.signing.authentication.Authenticator
|
||||
import com.r3.corda.signing.authentication.createProvider
|
||||
import com.r3.corda.signing.configuration.Parameters
|
||||
import com.r3.corda.signing.configuration.parseParameters
|
||||
import com.r3.corda.signing.generator.KeyCertificateGenerator
|
||||
import com.r3.corda.signing.hsm.HsmSigner
|
||||
import com.r3.corda.signing.menu.Menu
|
||||
import com.r3.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import com.r3.corda.signing.persistence.DBCertificateRequestStorage
|
||||
import com.r3.corda.signing.persistence.SigningServerSchemaService
|
||||
import com.r3.corda.signing.utils.mapCryptoServerException
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
run(parseParameters(*args))
|
||||
@ -21,7 +21,7 @@ fun run(parameters: Parameters) {
|
||||
parameters.run {
|
||||
// Create DB connection.
|
||||
checkNotNull(dataSourceProperties)
|
||||
val database = configureDatabase(dataSourceProperties!!, databaseProperties, { SigningServerSchemaService() }, createIdentityService = {
|
||||
val database = configureDatabase(dataSourceProperties, databaseProperties, { SigningServerSchemaService() }, createIdentityService = {
|
||||
// Identity service not needed
|
||||
throw UnsupportedOperationException()
|
||||
})
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.authentication
|
||||
package com.r3.corda.signing.authentication
|
||||
|
||||
/*
|
||||
* Supported authentication modes
|
@ -1,7 +1,7 @@
|
||||
package net.corda.signing.authentication
|
||||
package com.r3.corda.signing.authentication
|
||||
|
||||
import CryptoServerJCE.CryptoServerProvider
|
||||
import net.corda.signing.configuration.Parameters
|
||||
import com.r3.corda.signing.configuration.Parameters
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.Console
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.configuration
|
||||
package com.r3.corda.signing.configuration
|
||||
|
||||
import com.typesafe.config.Config
|
||||
import com.typesafe.config.ConfigFactory
|
||||
@ -8,7 +8,7 @@ import joptsimple.OptionParser
|
||||
import net.corda.core.internal.div
|
||||
import net.corda.node.utilities.X509Utilities
|
||||
import net.corda.nodeapi.config.parseAs
|
||||
import net.corda.signing.authentication.AuthMode
|
||||
import com.r3.corda.signing.authentication.AuthMode
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
@ -77,7 +77,7 @@ fun parseParameters(vararg args: String): Parameters {
|
||||
val argConfig = args.toConfigWithOptions {
|
||||
accepts("basedir", "Overriding configuration filepath, default to current directory.").withRequiredArg().defaultsTo(".").describedAs("filepath")
|
||||
accepts("configFile", "Overriding configuration file. (default: <<current directory>>/node.conf)").withRequiredArg().describedAs("filepath")
|
||||
accepts("device", "CryptoServer device address (default: ${Parameters.DEFAULT_DEVICE})").withRequiredArg().defaultsTo(Parameters.DEFAULT_DEVICE)
|
||||
accepts("device", "CryptoServer device address (default: ${Parameters.DEFAULT_DEVICE})").withRequiredArg()
|
||||
accepts("keyStorePass", "Password for the key store").withRequiredArg().describedAs("password")
|
||||
accepts("keyGroup", "CryptoServer key group (default: ${Parameters.DEFAULT_KEY_GROUP})").withRequiredArg().defaultsTo(Parameters.DEFAULT_KEY_GROUP)
|
||||
accepts("keySpecifier", "CryptoServer key specifier (default: ${Parameters.DEFAULT_KEY_SPECIFIER})").withRequiredArg().ofType(Int::class.java).defaultsTo(Parameters.DEFAULT_KEY_SPECIFIER)
|
@ -1,14 +1,14 @@
|
||||
package net.corda.signing.generator
|
||||
package com.r3.corda.signing.generator
|
||||
|
||||
import CryptoServerCXI.CryptoServerCXI
|
||||
import CryptoServerJCE.CryptoServerProvider
|
||||
import net.corda.node.utilities.addOrReplaceKey
|
||||
import net.corda.signing.authentication.Authenticator
|
||||
import net.corda.signing.utils.X509Utilities.createIntermediateCert
|
||||
import net.corda.signing.utils.X509Utilities.createSelfSignedCACert
|
||||
import net.corda.signing.utils.X509Utilities.getAndInitializeKeyStore
|
||||
import net.corda.signing.utils.X509Utilities.getCleanEcdsaKeyPair
|
||||
import net.corda.signing.utils.X509Utilities.retrieveCertificateAndKeys
|
||||
import com.r3.corda.signing.authentication.Authenticator
|
||||
import com.r3.corda.signing.utils.X509Utilities.createIntermediateCert
|
||||
import com.r3.corda.signing.utils.X509Utilities.createSelfSignedCACert
|
||||
import com.r3.corda.signing.utils.X509Utilities.getAndInitializeKeyStore
|
||||
import com.r3.corda.signing.utils.X509Utilities.getCleanEcdsaKeyPair
|
||||
import com.r3.corda.signing.utils.X509Utilities.retrieveCertificateAndKeys
|
||||
import java.security.KeyPair
|
||||
import java.security.KeyStore
|
||||
import java.security.PrivateKey
|
@ -1,13 +1,13 @@
|
||||
package net.corda.signing.hsm
|
||||
package com.r3.corda.signing.hsm
|
||||
|
||||
import net.corda.signing.authentication.Authenticator
|
||||
import net.corda.signing.authentication.readPassword
|
||||
import net.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import net.corda.signing.persistence.DBCertificateRequestStorage
|
||||
import net.corda.signing.utils.X509Utilities.buildCertPath
|
||||
import net.corda.signing.utils.X509Utilities.createClientCertificate
|
||||
import net.corda.signing.utils.X509Utilities.getAndInitializeKeyStore
|
||||
import net.corda.signing.utils.X509Utilities.retrieveCertificateAndKeys
|
||||
import com.r3.corda.signing.authentication.Authenticator
|
||||
import com.r3.corda.signing.authentication.readPassword
|
||||
import com.r3.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import com.r3.corda.signing.persistence.DBCertificateRequestStorage
|
||||
import com.r3.corda.signing.utils.X509Utilities.buildCertPath
|
||||
import com.r3.corda.signing.utils.X509Utilities.createClientCertificate
|
||||
import com.r3.corda.signing.utils.X509Utilities.getAndInitializeKeyStore
|
||||
import com.r3.corda.signing.utils.X509Utilities.retrieveCertificateAndKeys
|
||||
|
||||
/**
|
||||
* Encapsulates certificate signing logic
|
@ -1,6 +1,6 @@
|
||||
package net.corda.signing.hsm
|
||||
package com.r3.corda.signing.hsm
|
||||
|
||||
import net.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
import com.r3.corda.signing.persistence.ApprovedCertificateRequestData
|
||||
|
||||
/**
|
||||
* Encapsulates the logic related to the certificate signing process.
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.menu
|
||||
package com.r3.corda.signing.menu
|
||||
|
||||
data class MenuItem(val key: String, val label: String, val action: () -> Unit, val isTerminating: Boolean = false)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.persistence
|
||||
package com.r3.corda.signing.persistence
|
||||
|
||||
/**
|
||||
* Provides an API for database level manipulations of CSRs (Certificate Signing Requests).
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.persistence
|
||||
package com.r3.corda.signing.persistence
|
||||
|
||||
import net.corda.node.utilities.CordaPersistence
|
||||
import org.bouncycastle.pkcs.PKCS10CertificationRequest
|
||||
@ -91,7 +91,7 @@ class DBCertificateRequestStorage(private val database: CordaPersistence) : Cert
|
||||
where(builder.equal(get<Status>(CertificateSigningRequest::status.name), status))
|
||||
}
|
||||
}
|
||||
session.createQuery(query).resultList.map { it.toRequestData() }
|
||||
session.createQuery(query).setLockMode(LockModeType.PESSIMISTIC_WRITE).resultList.map { it.toRequestData() }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.persistence
|
||||
package com.r3.corda.signing.persistence
|
||||
|
||||
import net.corda.core.contracts.ContractState
|
||||
import net.corda.core.schemas.MappedSchema
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.utils
|
||||
package com.r3.corda.signing.utils
|
||||
|
||||
import CryptoServerAPI.CryptoServerException
|
||||
import java.util.HashMap
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.utils
|
||||
package com.r3.corda.signing.utils
|
||||
|
||||
import CryptoServerJCE.CryptoServerProvider
|
||||
import net.corda.core.identity.CordaX500Name
|
@ -1,4 +1,4 @@
|
||||
package net.corda.signing.authentication
|
||||
package com.r3.corda.signing.authentication
|
||||
|
||||
import CryptoServerCXI.CryptoServerCXI
|
||||
import CryptoServerJCE.CryptoServerProvider
|
@ -1,7 +1,7 @@
|
||||
package net.corda.signing.configuration
|
||||
package com.r3.corda.signing.configuration
|
||||
|
||||
import com.typesafe.config.ConfigException
|
||||
import net.corda.signing.authentication.AuthMode
|
||||
import com.r3.corda.signing.authentication.AuthMode
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFailsWith
|
@ -1,6 +1,5 @@
|
||||
package net.corda.signing.persistence
|
||||
package com.r3.corda.signing.persistence
|
||||
|
||||
import com.r3.corda.doorman.buildCertPath
|
||||
import net.corda.core.crypto.Crypto
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
@ -8,8 +7,8 @@ import net.corda.node.utilities.CertificateType
|
||||
import net.corda.node.utilities.CordaPersistence
|
||||
import net.corda.node.utilities.X509Utilities
|
||||
import net.corda.node.utilities.configureDatabase
|
||||
import net.corda.signing.persistence.DBCertificateRequestStorage.CertificateSigningRequest
|
||||
import net.corda.signing.persistence.DBCertificateRequestStorage.Status
|
||||
import com.r3.corda.signing.persistence.DBCertificateRequestStorage.CertificateSigningRequest
|
||||
import com.r3.corda.signing.persistence.DBCertificateRequestStorage.Status
|
||||
import org.bouncycastle.asn1.x509.GeneralName
|
||||
import org.bouncycastle.asn1.x509.GeneralSubtree
|
||||
import org.bouncycastle.asn1.x509.NameConstraints
|
||||
@ -28,6 +27,7 @@ import javax.persistence.criteria.Path
|
||||
import javax.persistence.criteria.Predicate
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
import com.r3.corda.signing.utils.X509Utilities.buildCertPath
|
||||
|
||||
class DBCertificateRequestStorageTest {
|
||||
private val intermediateCAKey = Crypto.generateKeyPair(X509Utilities.DEFAULT_TLS_SIGNATURE_SCHEME)
|
Loading…
Reference in New Issue
Block a user