From 684d1089f0589e38ba116d767c02f97f3edd6954 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Thu, 13 Apr 2017 17:41:54 +0100 Subject: [PATCH] Introduce full legal names for test parties Use full names for test parties, ahead of complete X.500 name support. --- build.gradle | 8 ++++---- .../corda/client/rpc/AbstractClientRPCTest.kt | 3 ++- config/dev/generalnodea.conf | 2 +- config/dev/nameservernode.conf | 2 +- .../net/corda/core/utilities/TestConstants.kt | 17 +++++++++-------- .../kotlin/net/corda/core/crypto/PartyTest.kt | 3 ++- .../net/corda/core/node/ServiceInfoTests.kt | 3 ++- docs/source/corda-configuration-file.rst | 2 +- docs/source/creating-a-cordapp.rst | 8 ++++---- docs/source/example-code/build.gradle | 6 +++--- .../kotlin/net/corda/docs/ClientRpcTutorial.kt | 7 +++++-- .../resources/example-network-map-node.conf | 2 +- .../src/main/resources/example-node.conf | 4 ++-- .../example-out-of-process-verifier-node.conf | 4 ++-- docs/source/release-notes.rst | 10 ++++++++++ docs/source/shell.rst | 4 ++-- docs/source/tutorial-clientrpc-api.rst | 2 +- docs/source/tutorial-cordapp.rst | 6 +++--- .../contracts/universal/ContractDefinition.kt | 10 +++++++--- .../kotlin/net/corda/contracts/asset/Cash.kt | 2 +- .../net/corda/contracts/asset/Obligation.kt | 2 +- .../kotlin/net/corda/node/driver/DriverTests.kt | 2 +- .../node/services/BFTNotaryServiceTests.kt | 2 +- .../node/services/RaftNotaryServiceTests.kt | 2 +- .../corda/services/messaging/P2PSecurityTest.kt | 4 ++-- .../net/corda/node/internal/AbstractNode.kt | 3 ++- .../net/corda/node/InteractiveShellTest.kt | 10 ++++++---- .../corda/node/services/NotaryChangeTests.kt | 3 ++- .../config/FullNodeConfigurationTest.kt | 3 ++- .../services/messaging/ArtemisMessagingTests.kt | 4 +++- .../network/AbstractNetworkMapServiceTest.kt | 5 +++-- .../network/InMemoryIdentityServiceTests.kt | 6 ++++-- .../network/InMemoryNetworkMapCacheTest.kt | 6 ++++-- .../statemachine/StateMachineManagerTests.kt | 7 ++++--- .../NetworkisRegistrationHelperTest.kt | 3 ++- samples/attachment-demo/build.gradle | 8 ++++---- .../net/corda/attachmentdemo/AttachmentDemo.kt | 5 +++-- samples/bank-of-corda-demo/README.md | 2 +- samples/bank-of-corda-demo/build.gradle | 10 +++++----- .../net/corda/bank/BankOfCordaHttpAPITest.kt | 4 ++-- .../net/corda/bank/BankOfCordaRPCClientTest.kt | 2 +- .../kotlin/net/corda/bank/BankOfCordaDriver.kt | 7 +++++-- samples/irs-demo/build.gradle | 8 ++++---- .../kotlin/net/corda/simulation/Simulation.kt | 9 ++++++--- .../src/main/resources/example-irs-trade.json | 4 ++-- .../resources/irsweb/js/viewmodel/FixedLeg.js | 4 ++-- .../irsweb/js/viewmodel/FloatingLeg.js | 4 ++-- .../corda/irs/testing/NodeInterestRatesTest.kt | 3 ++- samples/raft-notary-demo/build.gradle | 12 ++++++------ samples/simm-valuation-demo/build.gradle | 12 ++++++------ .../app/viewmodel/FixedLegViewModel.js | 4 ++-- .../app/viewmodel/FloatingLegViewModel.js | 4 ++-- .../src/app/viewmodel/FloatingLegViewModel.ts | 2 +- samples/trader-demo/build.gradle | 10 +++++----- .../kotlin/net/corda/traderdemo/TraderDemo.kt | 2 +- .../net/corda/traderdemo/flow/SellerFlow.kt | 7 +++++-- .../kotlin/net/corda/testing/CoreTestUtils.kt | 2 +- .../net/corda/demobench/model/NodeConfigTest.kt | 2 +- 58 files changed, 170 insertions(+), 124 deletions(-) diff --git a/build.gradle b/build.gradle index f5d7e941f1..2fa275185e 100644 --- a/build.gradle +++ b/build.gradle @@ -188,16 +188,16 @@ tasks.withType(Test) { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "Controller" + networkMap "CN=Controller,O=R3,OU=corda,L=London,C=UK" node { - name "Controller" + name "CN=Controller,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = ["corda.notary.validating"] p2pPort 10002 cordapps = [] } node { - name "Bank A" + name "CN=Bank A,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10012 @@ -206,7 +206,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { cordapps = [] } node { - name "Bank B" + name "CN=Bank B,O=R3,OU=corda,L=London,C=UK" nearestCity "New York" advertisedServices = [] p2pPort 10007 diff --git a/client/rpc/src/test/kotlin/net/corda/client/rpc/AbstractClientRPCTest.kt b/client/rpc/src/test/kotlin/net/corda/client/rpc/AbstractClientRPCTest.kt index 80b95192a6..ae3420686e 100644 --- a/client/rpc/src/test/kotlin/net/corda/client/rpc/AbstractClientRPCTest.kt +++ b/client/rpc/src/test/kotlin/net/corda/client/rpc/AbstractClientRPCTest.kt @@ -2,6 +2,7 @@ package net.corda.client.rpc import net.corda.core.messaging.RPCOps import net.corda.core.serialization.SerializedBytes +import net.corda.core.utilities.ALICE import net.corda.core.utilities.LogHelper import net.corda.node.services.RPCUserService import net.corda.node.services.messaging.RPCDispatcher @@ -73,7 +74,7 @@ abstract class AbstractClientRPCTest { override val users: List get() = listOf(rpcUser) } - val dispatcher = object : RPCDispatcher(rpcImpl, userService, "SomeName") { + val dispatcher = object : RPCDispatcher(rpcImpl, userService, ALICE.name) { override fun send(data: SerializedBytes<*>, toAddress: String) { val msg = serverSession.createMessage(false).apply { writeBodyBufferBytes(data.bytes) diff --git a/config/dev/generalnodea.conf b/config/dev/generalnodea.conf index 366c5bbfc1..3b63482c7c 100644 --- a/config/dev/generalnodea.conf +++ b/config/dev/generalnodea.conf @@ -1,4 +1,4 @@ -myLegalName : "Bank A" +myLegalName : "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity : "London" keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" diff --git a/config/dev/nameservernode.conf b/config/dev/nameservernode.conf index feab919ab2..73591fa46d 100644 --- a/config/dev/nameservernode.conf +++ b/config/dev/nameservernode.conf @@ -1,4 +1,4 @@ -myLegalName : "Notary Service" +myLegalName : "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity : "London" keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" diff --git a/core/src/main/kotlin/net/corda/core/utilities/TestConstants.kt b/core/src/main/kotlin/net/corda/core/utilities/TestConstants.kt index 6fda733885..10a3ae85d8 100644 --- a/core/src/main/kotlin/net/corda/core/utilities/TestConstants.kt +++ b/core/src/main/kotlin/net/corda/core/utilities/TestConstants.kt @@ -3,6 +3,7 @@ package net.corda.core.utilities import net.corda.core.crypto.* +import org.bouncycastle.asn1.x500.X500Name import java.math.BigInteger import java.security.KeyPair import java.security.PublicKey @@ -19,34 +20,34 @@ val DUMMY_KEY_2: KeyPair by lazy { generateKeyPair() } val DUMMY_NOTARY_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(20)) } /** Dummy notary identity for tests and simulations */ -val DUMMY_NOTARY: Party get() = Party("Notary Service", DUMMY_NOTARY_KEY.public) +val DUMMY_NOTARY: Party get() = Party("CN=Notary Service,O=R3,OU=corda,L=London,C=UK", DUMMY_NOTARY_KEY.public) val DUMMY_MAP_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(30)) } /** Dummy network map service identity for tests and simulations */ -val DUMMY_MAP: Party get() = Party("Network Map Service", DUMMY_MAP_KEY.public) +val DUMMY_MAP: Party get() = Party("CN=Network Map Service,O=R3,OU=corda,L=London,C=UK", DUMMY_MAP_KEY.public) val DUMMY_BANK_A_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(40)) } /** Dummy bank identity for tests and simulations */ -val DUMMY_BANK_A: Party get() = Party("Bank A", DUMMY_BANK_A_KEY.public) +val DUMMY_BANK_A: Party get() = Party("CN=Bank A,O=Bank A,L=London,C=UK", DUMMY_BANK_A_KEY.public) val DUMMY_BANK_B_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(50)) } /** Dummy bank identity for tests and simulations */ -val DUMMY_BANK_B: Party get() = Party("Bank B", DUMMY_BANK_B_KEY.public) +val DUMMY_BANK_B: Party get() = Party("CN=Bank B,O=Bank B,L=New York,C=USA", DUMMY_BANK_B_KEY.public) val DUMMY_BANK_C_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(60)) } /** Dummy bank identity for tests and simulations */ -val DUMMY_BANK_C: Party get() = Party("Bank C", DUMMY_BANK_C_KEY.public) +val DUMMY_BANK_C: Party get() = Party("CN=Bank C,O=Bank C,L=Tokyo,C=Japan", DUMMY_BANK_C_KEY.public) val ALICE_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(70)) } /** Dummy individual identity for tests and simulations */ -val ALICE: Party get() = Party("Alice", ALICE_KEY.public) +val ALICE: Party get() = Party("CN=Alice Corp,O=Alice Corp,L=London,C=UK", ALICE_KEY.public) val BOB_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(80)) } /** Dummy individual identity for tests and simulations */ -val BOB: Party get() = Party("Bob", BOB_KEY.public) +val BOB: Party get() = Party("CN=Bob Plc,O=Bob Plc,L=London,C=UK", BOB_KEY.public) val CHARLIE_KEY: KeyPair by lazy { entropyToKeyPair(BigInteger.valueOf(90)) } /** Dummy individual identity for tests and simulations */ -val CHARLIE: Party get() = Party("Charlie", CHARLIE_KEY.public) \ No newline at end of file +val CHARLIE: Party get() = Party("CN=Charlie Ltd,O=Charlie Ltd,L=London,C=UK", CHARLIE_KEY.public) diff --git a/core/src/test/kotlin/net/corda/core/crypto/PartyTest.kt b/core/src/test/kotlin/net/corda/core/crypto/PartyTest.kt index f95ffa93b1..6f121e2cec 100644 --- a/core/src/test/kotlin/net/corda/core/crypto/PartyTest.kt +++ b/core/src/test/kotlin/net/corda/core/crypto/PartyTest.kt @@ -1,5 +1,6 @@ package net.corda.core.crypto +import net.corda.core.utilities.ALICE import org.junit.Test import java.math.BigInteger import kotlin.test.assertEquals @@ -11,7 +12,7 @@ class PartyTest { val key = entropyToKeyPair(BigInteger.valueOf(20170207L)).public val differentKey = entropyToKeyPair(BigInteger.valueOf(7201702L)).public val anonymousParty = AnonymousParty(key) - val party = Party("test key", key) + val party = Party(ALICE.name, key) assertEquals(party, anonymousParty) assertEquals(anonymousParty, party) assertNotEquals(AnonymousParty(differentKey), anonymousParty) diff --git a/core/src/test/kotlin/net/corda/core/node/ServiceInfoTests.kt b/core/src/test/kotlin/net/corda/core/node/ServiceInfoTests.kt index 4c2a52a1ce..0d408beb3c 100644 --- a/core/src/test/kotlin/net/corda/core/node/ServiceInfoTests.kt +++ b/core/src/test/kotlin/net/corda/core/node/ServiceInfoTests.kt @@ -1,5 +1,6 @@ package net.corda.core.node +import net.corda.core.crypto.X509Utilities import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceType import org.junit.Test @@ -8,7 +9,7 @@ import kotlin.test.assertFailsWith class ServiceInfoTests { val serviceType = ServiceType.getServiceType("test", "service").getSubType("subservice") - val name = "service.name" + val name = "CN=service.name,O=R3,OU=corda,L=London,C=UK" @Test fun `type and name encodes correctly`() { diff --git a/docs/source/corda-configuration-file.rst b/docs/source/corda-configuration-file.rst index a4e7f7a93a..846258f481 100644 --- a/docs/source/corda-configuration-file.rst +++ b/docs/source/corda-configuration-file.rst @@ -34,7 +34,7 @@ NetworkMapService plus Simple Notary configuration file. .. parsed-literal:: - myLegalName : "Notary Service" + myLegalName : "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity : "London" keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" diff --git a/docs/source/creating-a-cordapp.rst b/docs/source/creating-a-cordapp.rst index a1884718fe..4e075db65a 100644 --- a/docs/source/creating-a-cordapp.rst +++ b/docs/source/creating-a-cordapp.rst @@ -194,9 +194,9 @@ is a three node example; task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" // The output directory - networkMap "Controller" // The artemis address of the node named here will be used as the networkMapService.address on all other nodes. + networkMap "CN=Controller,O=R3,OU=corda,L=London,C=UK" // The distinguished name of the node named here will be used as the networkMapService.address on all other nodes. node { - name "Controller" + name "CN=Controller,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [ "corda.notary.validating" ] p2pPort 10002 @@ -206,7 +206,7 @@ is a three node example; cordapps [] } node { - name "NodeA" + name "CN=NodeA,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10005 @@ -216,7 +216,7 @@ is a three node example; cordapps [] } node { - name "NodeB" + name "CN=NodeB,O=R3,OU=corda,L=New York,C=USA" nearestCity "New York" advertisedServices = [] p2pPort 10008 diff --git a/docs/source/example-code/build.gradle b/docs/source/example-code/build.gradle index 9ae3fcf5a2..48e21260dd 100644 --- a/docs/source/example-code/build.gradle +++ b/docs/source/example-code/build.gradle @@ -76,9 +76,9 @@ task integrationTest(type: Test) { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "Notary" + networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" node { - name "Notary" + name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = ["corda.notary.validating"] p2pPort 10002 @@ -87,7 +87,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { cordapps = [] } node { - name "Alice" + name "CN=Alice Corp,O=Alice Corp,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10005 diff --git a/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt b/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt index 99b1571c03..aeb4bfb08b 100644 --- a/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt +++ b/docs/source/example-code/src/main/kotlin/net/corda/docs/ClientRpcTutorial.kt @@ -3,6 +3,7 @@ package net.corda.docs import net.corda.contracts.asset.Cash import net.corda.core.contracts.Amount import net.corda.core.contracts.USD +import net.corda.core.crypto.X509Utilities import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.startFlow import net.corda.core.node.CordaPluginRegistry @@ -11,6 +12,8 @@ import net.corda.core.serialization.CordaSerializable import net.corda.core.serialization.OpaqueBytes import net.corda.core.serialization.SerializationCustomization import net.corda.core.transactions.SignedTransaction +import net.corda.core.utilities.ALICE +import net.corda.core.utilities.DUMMY_NOTARY import net.corda.flows.CashExitFlow import net.corda.flows.CashIssueFlow import net.corda.flows.CashPaymentFlow @@ -46,8 +49,8 @@ fun main(args: Array) { startFlowPermission())) driver(driverDirectory = baseDirectory) { - startNode("Notary", advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type))) - val node = startNode("Alice", rpcUsers = listOf(user)).get() + startNode(DUMMY_NOTARY.name, advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type))) + val node = startNode(ALICE.name, rpcUsers = listOf(user)).get() // END 1 // START 2 diff --git a/docs/source/example-code/src/main/resources/example-network-map-node.conf b/docs/source/example-code/src/main/resources/example-network-map-node.conf index 9015e5c705..1cebb8b8c5 100644 --- a/docs/source/example-code/src/main/resources/example-network-map-node.conf +++ b/docs/source/example-code/src/main/resources/example-network-map-node.conf @@ -1,4 +1,4 @@ -myLegalName : "Notary Service" +myLegalName : "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity : "London" keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" diff --git a/docs/source/example-code/src/main/resources/example-node.conf b/docs/source/example-code/src/main/resources/example-node.conf index eccf34c03c..de024c5215 100644 --- a/docs/source/example-code/src/main/resources/example-node.conf +++ b/docs/source/example-code/src/main/resources/example-node.conf @@ -1,4 +1,4 @@ -myLegalName : "Bank A" +myLegalName : "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity : "London" keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" @@ -14,7 +14,7 @@ webAddress : "localhost:10004" extraAdvertisedServiceIds : [ "corda.interest_rates" ] networkMapService : { address : "my-network-map:10000" - legalName : "Network Map Service" + legalName : "CN=Network Map Service,O=R3,OU=corda,L=London,C=UK" } useHTTPS : false rpcUsers : [ diff --git a/docs/source/example-code/src/main/resources/example-out-of-process-verifier-node.conf b/docs/source/example-code/src/main/resources/example-out-of-process-verifier-node.conf index a98bb3d3e7..f7636fc105 100644 --- a/docs/source/example-code/src/main/resources/example-out-of-process-verifier-node.conf +++ b/docs/source/example-code/src/main/resources/example-out-of-process-verifier-node.conf @@ -1,9 +1,9 @@ -myLegalName : "Bank A" +myLegalName : "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity : "London" p2pAddress : "my-corda-node:10002" webAddress : "localhost:10003" networkMapService : { address : "my-network-map:10000" - legalName : "Network Map Service" + legalName : "CN=Network Map Service,O=R3,OU=corda,L=London,C=UK" } verifierType: "OutOfProcess" diff --git a/docs/source/release-notes.rst b/docs/source/release-notes.rst index 448733d72e..50377ff2bc 100644 --- a/docs/source/release-notes.rst +++ b/docs/source/release-notes.rst @@ -12,6 +12,16 @@ composite key signatures. This will form the underlying basis of future work to formats to enable interoperability with other systems, as well as enabling the use of composite signatures on X.509 certificates to prove association between transaction keys and identity keys. +The identity work is likely to require changes to existing code and configurations, to replace party names with full +X.500 distinguished names (see RFC 1779 for details on the construction of distinguished names). Generally: + +* "myLegalName" in node configurations will need to be replaced, for example "Bank A" is replaced with + "CN=Bank A,O=Bank A,L=London,C=UK". Obviously organisation, location and country ("O", "L" and "C" respectively) + must be given values which are appropriate to the node, do not just use these example values. +* If you are constructing ``Party`` objects, be aware that the name must now be a distinguished name. +* If you are using mock parties for testing, try to standardise on the ``DUMMY_NOTARY``, ``DUMMY_BANK_A``, etc. provided + in order to ensure consistency. + We have updated DemoBench so that it is installed as "Corda DemoBench" for both Windows and MacOSX. The original version was installed as just "DemoBench", and so will not be overwritten automatically by the new version. Milestone 10 diff --git a/docs/source/shell.rst b/docs/source/shell.rst index e5d0089966..3e53ae1113 100644 --- a/docs/source/shell.rst +++ b/docs/source/shell.rst @@ -67,7 +67,7 @@ Yaml (yet another markup language) is a simple JSON-like way to describe object that make it helpful for our use case, like a lightweight syntax and support for "bare words" which mean you can often skip the quotes around strings. Here is an example of how this syntax is used: -``flow start CashIssue amount: $1000, issueRef: 1234, recipient: Bank A, notary: Notary Service`` +``flow start CashIssue amount: $1000, issueRef: 1234, recipient: "CN=Bank A,O=Bank A,L=London,C=UK", notary: "CN=Notary Service,O=R3,OU=corda,L=London,C=UK"`` This invokes a constructor of a flow with the following prototype in the code: @@ -140,4 +140,4 @@ The shell will be enhanced over time. The currently known limitations include: .. _Yaml: http://www.yaml.org/spec/1.2/spec.html .. _the defined parsers: api/kotlin/corda/net.corda.jackson/-jackson-support/index.html .. _Groovy: http://groovy-lang.org/ -.. _CRaSH: http://www.crashub.org/ \ No newline at end of file +.. _CRaSH: http://www.crashub.org/ diff --git a/docs/source/tutorial-clientrpc-api.rst b/docs/source/tutorial-clientrpc-api.rst index 0e6afef34e..73ea5a485b 100644 --- a/docs/source/tutorial-clientrpc-api.rst +++ b/docs/source/tutorial-clientrpc-api.rst @@ -116,7 +116,7 @@ In the instructions above the server node permissions are configured programmati driver(driverDirectory = baseDirectory) { val user = User("user", "password", permissions = setOf(startFlowPermission())) - val node = startNode("Alice", rpcUsers = listOf(user)).get() + val node = startNode("CN=Alice Corp,O=Alice Corp,L=London,C=UK", rpcUsers = listOf(user)).get() When starting a standalone node using a configuration file we must supply the RPC credentials as follows: diff --git a/docs/source/tutorial-cordapp.rst b/docs/source/tutorial-cordapp.rst index 88d26da3b8..2b9d7c1631 100644 --- a/docs/source/tutorial-cordapp.rst +++ b/docs/source/tutorial-cordapp.rst @@ -774,9 +774,9 @@ like to deploy for testing. See further details below: task deployNodes(type: com.r3corda.plugins.Cordform, dependsOn: ['jar']) { directory "./kotlin-source/build/nodes" // The output directory. - networkMap "Controller" // The artemis address of the node to be used as the network map. + networkMap "CN=Controller,O=R3,OU=corda,L=London,C=UK" // The distinguished name of the node to be used as the network map. node { - name "Controller" // Artemis name of node to be deployed. + name "CN=Controller,O=R3,OU=corda,L=London,C=UK" // Distinguished name of node to be deployed. nearestCity "London" // For use with the network visualiser. advertisedServices = ["corda.notary.validating"] // A list of services you wish the node to offer. p2pPort 10002 @@ -785,7 +785,7 @@ like to deploy for testing. See further details below: cordapps = [] // Add package names of CordaApps. } node { // Create an additional node. - name "NodeA" + name "CN=NodeA,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10005 diff --git a/experimental/src/test/kotlin/net/corda/contracts/universal/ContractDefinition.kt b/experimental/src/test/kotlin/net/corda/contracts/universal/ContractDefinition.kt index f6f6015b8b..ef37a78fbc 100644 --- a/experimental/src/test/kotlin/net/corda/contracts/universal/ContractDefinition.kt +++ b/experimental/src/test/kotlin/net/corda/contracts/universal/ContractDefinition.kt @@ -1,14 +1,18 @@ package net.corda.contracts.universal import net.corda.core.crypto.Party +import net.corda.core.crypto.X509Utilities import net.corda.core.crypto.generateKeyPair +import net.corda.core.utilities.ALICE +import net.corda.testing.MEGA_CORP +import net.corda.testing.MINI_CORP import org.junit.Test import java.util.* // Test parties -val acmeCorp = Party("ACME Corporation", generateKeyPair().public) -val highStreetBank = Party("High Street Bank", generateKeyPair().public) -val momAndPop = Party("Mom and Pop", generateKeyPair().public) +val acmeCorp = Party(ALICE.name, generateKeyPair().public) +val highStreetBank = Party(MEGA_CORP.name, generateKeyPair().public) +val momAndPop = Party(MINI_CORP.name, generateKeyPair().public) val acmeCorporationHasDefaulted = TerminalEvent(acmeCorp, generateKeyPair().public) diff --git a/finance/src/main/kotlin/net/corda/contracts/asset/Cash.kt b/finance/src/main/kotlin/net/corda/contracts/asset/Cash.kt index d893abfe6f..683b90f745 100644 --- a/finance/src/main/kotlin/net/corda/contracts/asset/Cash.kt +++ b/finance/src/main/kotlin/net/corda/contracts/asset/Cash.kt @@ -203,7 +203,7 @@ infix fun Cash.State.`with deposit`(deposit: PartyAndReference): Cash.State = wi /** A randomly generated key. */ val DUMMY_CASH_ISSUER_KEY by lazy { entropyToKeyPair(BigInteger.valueOf(10)) } /** A dummy, randomly generated issuer party by the name of "Snake Oil Issuer" */ -val DUMMY_CASH_ISSUER by lazy { Party("Snake Oil Issuer", DUMMY_CASH_ISSUER_KEY.public).ref(1) } +val DUMMY_CASH_ISSUER by lazy { Party("CN=Snake Oil Issuer,O=R3,OU=corda,L=London,C=UK", DUMMY_CASH_ISSUER_KEY.public).ref(1) } /** An extension property that lets you write 100.DOLLARS.CASH */ val Amount.CASH: Cash.State get() = Cash.State(Amount(quantity, Issued(DUMMY_CASH_ISSUER, token)), NullPublicKey) /** An extension property that lets you get a cash state from an issued token, under the [NullPublicKey] */ diff --git a/finance/src/main/kotlin/net/corda/contracts/asset/Obligation.kt b/finance/src/main/kotlin/net/corda/contracts/asset/Obligation.kt index 4007fd80b2..55688d6885 100644 --- a/finance/src/main/kotlin/net/corda/contracts/asset/Obligation.kt +++ b/finance/src/main/kotlin/net/corda/contracts/asset/Obligation.kt @@ -719,7 +719,7 @@ infix fun Obligation.State.`issued by`(party: AbstractParty) = copy /** A randomly generated key. */ val DUMMY_OBLIGATION_ISSUER_KEY by lazy { entropyToKeyPair(BigInteger.valueOf(10)) } /** A dummy, randomly generated issuer party by the name of "Snake Oil Issuer" */ -val DUMMY_OBLIGATION_ISSUER by lazy { Party("Snake Oil Issuer", DUMMY_OBLIGATION_ISSUER_KEY.public) } +val DUMMY_OBLIGATION_ISSUER by lazy { Party("CN=Snake Oil Issuer,O=R3,OU=corda,L=London,C=UK", DUMMY_OBLIGATION_ISSUER_KEY.public) } val Issued.OBLIGATION_DEF: Obligation.Terms get() = Obligation.Terms(nonEmptySetOf(Cash().legalContractReference), nonEmptySetOf(this), TEST_TX_TIME) diff --git a/node/src/integration-test/kotlin/net/corda/node/driver/DriverTests.kt b/node/src/integration-test/kotlin/net/corda/node/driver/DriverTests.kt index cc9dce7fc6..9d4fa62463 100644 --- a/node/src/integration-test/kotlin/net/corda/node/driver/DriverTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/driver/DriverTests.kt @@ -42,7 +42,7 @@ class DriverTests { fun `simple node startup and shutdown`() { val handles = driver { val notary = startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type))) - val regulator = startNode("Regulator", setOf(ServiceInfo(RegulatorService.type))) + val regulator = startNode("CN=Regulator,O=R3,OU=corda,L=London,C=UK", setOf(ServiceInfo(RegulatorService.type))) listOf(nodeMustBeUp(notary), nodeMustBeUp(regulator)) } handles.map { nodeMustBeDown(it) } diff --git a/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt index 37de85bf19..e1c5b0b48e 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt @@ -98,4 +98,4 @@ class BFTNotaryServiceTests : NodeBasedTest() { return remainingNodes + masterNode } -} \ No newline at end of file +} diff --git a/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt index 44fee7248e..e6f3725d9c 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/RaftNotaryServiceTests.kt @@ -22,7 +22,7 @@ import kotlin.test.assertEquals import kotlin.test.assertFailsWith class RaftNotaryServiceTests : NodeBasedTest() { - private val notaryName = "RAFT Notary Service" + private val notaryName = "CN=RAFT Notary Service,O=R3,OU=corda,L=London,C=UK" @Test fun `detect double spend`() { diff --git a/node/src/integration-test/kotlin/net/corda/services/messaging/P2PSecurityTest.kt b/node/src/integration-test/kotlin/net/corda/services/messaging/P2PSecurityTest.kt index 4a67b7d388..93d83f4495 100644 --- a/node/src/integration-test/kotlin/net/corda/services/messaging/P2PSecurityTest.kt +++ b/node/src/integration-test/kotlin/net/corda/services/messaging/P2PSecurityTest.kt @@ -42,9 +42,9 @@ class P2PSecurityTest : NodeBasedTest() { @Test fun `register with the network map service using a legal name different from the TLS CN`() { - startSimpleNode("Attacker").use { + startSimpleNode("CN=Attacker,O=R3,OU=corda,L=London,C=UK").use { // Register with the network map using a different legal name - val response = it.registerWithNetworkMap("Legit Business") + val response = it.registerWithNetworkMap("CN=Legit Business,O=R3,OU=corda,L=London,C=UK") // We don't expect a response because the network map's host verification will prevent a connection back // to the attacker as the TLS CN will not match the legal name it has just provided assertThatExceptionOfType(TimeoutException::class.java).isThrownBy { diff --git a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt index 2f0bddf309..792ab34a68 100644 --- a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt @@ -51,6 +51,7 @@ import net.corda.node.utilities.AffinityExecutor import net.corda.node.utilities.configureDatabase import net.corda.node.utilities.transaction import org.apache.activemq.artemis.utils.ReusableLatch +import org.bouncycastle.asn1.x500.X500Name import org.jetbrains.exposed.sql.Database import org.slf4j.Logger import java.io.IOException @@ -305,7 +306,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration, protected open fun makeServiceEntries(): List { return advertisedServices.map { val serviceId = it.type.id - val serviceName = it.name ?: "$serviceId|${configuration.myLegalName}" + val serviceName = it.name ?: "ou=$serviceId,${configuration.myLegalName}" val identity = obtainKeyPair(configuration.baseDirectory, serviceId + "-private-key", serviceId + "-public", serviceName).first ServiceEntry(it, identity) } diff --git a/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt b/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt index 6cbecc6f8e..411559c2b7 100644 --- a/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt +++ b/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt @@ -5,6 +5,7 @@ import com.google.common.util.concurrent.ListenableFuture import net.corda.core.contracts.Amount import net.corda.core.crypto.Party import net.corda.core.crypto.SecureHash +import net.corda.core.crypto.X509Utilities import net.corda.core.flows.FlowLogic import net.corda.core.flows.FlowStateMachine import net.corda.core.flows.StateMachineRunId @@ -16,6 +17,7 @@ import net.corda.core.utilities.UntrustworthyData import net.corda.jackson.JacksonSupport import net.corda.node.services.identity.InMemoryIdentityService import net.corda.node.shell.InteractiveShell +import net.corda.testing.MEGA_CORP import org.junit.Test import org.slf4j.Logger import java.util.* @@ -28,12 +30,12 @@ class InteractiveShellTest { constructor(b: Int, c: String) : this(b.toString() + c) constructor(amount: Amount) : this(amount.toString()) constructor(pair: Pair, SecureHash.SHA256>) : this(pair.toString()) - constructor(party: Party) : this(party.name) - + constructor(party: Party) : this(party.name.toString()) override fun call() = a } - private val ids = InMemoryIdentityService().apply { registerIdentity(Party("SomeCorp", DUMMY_PUBKEY_1)) } + private val someCorpLegalName = MEGA_CORP.name + private val ids = InMemoryIdentityService().apply { registerIdentity(Party(MEGA_CORP.name, DUMMY_PUBKEY_1)) } private val om = JacksonSupport.createInMemoryMapper(ids, YAMLFactory()) private fun check(input: String, expected: String) { @@ -66,7 +68,7 @@ class InteractiveShellTest { fun flowTooManyParams() = check("b: 12, c: Yo, d: Bar", "") @Test - fun party() = check("party: SomeCorp", "SomeCorp") + fun party() = check("party: \"${someCorpLegalName}\"", someCorpLegalName) class DummyFSM(val logic: FlowA) : FlowStateMachine { override fun sendAndReceive(receiveType: Class, otherParty: Party, payload: Any, sessionFlow: FlowLogic<*>): UntrustworthyData { diff --git a/node/src/test/kotlin/net/corda/node/services/NotaryChangeTests.kt b/node/src/test/kotlin/net/corda/node/services/NotaryChangeTests.kt index a8b78d2419..560f22e6a4 100644 --- a/node/src/test/kotlin/net/corda/node/services/NotaryChangeTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/NotaryChangeTests.kt @@ -2,6 +2,7 @@ package net.corda.node.services import net.corda.core.contracts.* import net.corda.core.crypto.Party +import net.corda.core.crypto.X509Utilities import net.corda.core.crypto.generateKeyPair import net.corda.core.getOrThrow import net.corda.core.node.services.ServiceInfo @@ -74,7 +75,7 @@ class NotaryChangeTests { @Test fun `should throw when a participant refuses to change Notary`() { val state = issueMultiPartyState(clientNodeA, clientNodeB, oldNotaryNode) - val newEvilNotary = Party("Evil Notary", generateKeyPair().public) + val newEvilNotary = Party("CN=Evil Notary,O=Evil R3,OU=corda,L=London,C=UK", generateKeyPair().public) val flow = Instigator(state, newEvilNotary) val future = clientNodeA.services.startFlow(flow) diff --git a/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt b/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt index edf727af61..fca4598ebf 100644 --- a/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/config/FullNodeConfigurationTest.kt @@ -1,5 +1,6 @@ package net.corda.node.services.config +import net.corda.core.utilities.ALICE import net.corda.nodeapi.User import net.corda.testing.testConfiguration import org.assertj.core.api.Assertions.assertThatThrownBy @@ -10,7 +11,7 @@ class FullNodeConfigurationTest { @Test fun `Artemis special characters not permitted in RPC usernames`() { fun configWithRPCUsername(username: String): FullNodeConfiguration { - return testConfiguration(Paths.get("."), "NodeA", 0).copy( + return testConfiguration(Paths.get("."), ALICE.name, 0).copy( rpcUsers = listOf(User(username, "pass", emptySet()))) } diff --git a/node/src/test/kotlin/net/corda/node/services/messaging/ArtemisMessagingTests.kt b/node/src/test/kotlin/net/corda/node/services/messaging/ArtemisMessagingTests.kt index b47d96125d..b4c24d7894 100644 --- a/node/src/test/kotlin/net/corda/node/services/messaging/ArtemisMessagingTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/messaging/ArtemisMessagingTests.kt @@ -6,11 +6,13 @@ import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.ListenableFuture import com.google.common.util.concurrent.SettableFuture import com.typesafe.config.ConfigFactory.empty +import net.corda.core.crypto.X509Utilities import net.corda.core.crypto.generateKeyPair import net.corda.core.messaging.Message import net.corda.core.messaging.RPCOps import net.corda.core.messaging.createMessage import net.corda.core.node.services.DEFAULT_SESSION_ID +import net.corda.core.utilities.ALICE import net.corda.core.utilities.LogHelper import net.corda.node.services.RPCUserService import net.corda.node.services.RPCUserServiceImpl @@ -73,7 +75,7 @@ class ArtemisMessagingTests { userService = RPCUserServiceImpl(emptyList()) config = TestNodeConfiguration( baseDirectory = baseDirectory, - myLegalName = "me", + myLegalName = ALICE.name, networkMapService = null) LogHelper.setLevel(PersistentUniquenessProvider::class) val dataSourceAndDatabase = configureDatabase(makeTestDataSourceProperties()) diff --git a/node/src/test/kotlin/net/corda/node/services/network/AbstractNetworkMapServiceTest.kt b/node/src/test/kotlin/net/corda/node/services/network/AbstractNetworkMapServiceTest.kt index fdd101f495..d975ead05f 100644 --- a/node/src/test/kotlin/net/corda/node/services/network/AbstractNetworkMapServiceTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/network/AbstractNetworkMapServiceTest.kt @@ -10,6 +10,7 @@ import net.corda.core.node.services.ServiceInfo import net.corda.core.serialization.deserialize import net.corda.core.utilities.ALICE import net.corda.core.utilities.BOB +import net.corda.core.utilities.CHARLIE import net.corda.flows.sendRequest import net.corda.node.services.config.NodeConfiguration import net.corda.node.services.network.AbstractNetworkMapServiceTest.Changed.Added @@ -141,7 +142,7 @@ abstract class AbstractNetworkMapServiceTest val updates = alice.subscribe() val bob = addNewNodeToNetworkMap(BOB.name) alice.unsubscribe() - addNewNodeToNetworkMap("Charlie") + addNewNodeToNetworkMap(CHARLIE.name) swizzle() assertThat(updates.map { it.wireReg.verified().toChanged() }).containsOnly(Added(bob.info)) } @@ -274,4 +275,4 @@ abstract class AbstractNetworkMapServiceTest } } } -} \ No newline at end of file +} diff --git a/node/src/test/kotlin/net/corda/node/services/network/InMemoryIdentityServiceTests.kt b/node/src/test/kotlin/net/corda/node/services/network/InMemoryIdentityServiceTests.kt index f1a40b566b..973b69bd0f 100644 --- a/node/src/test/kotlin/net/corda/node/services/network/InMemoryIdentityServiceTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/network/InMemoryIdentityServiceTests.kt @@ -1,6 +1,7 @@ package net.corda.node.services.network import net.corda.core.crypto.Party +import net.corda.core.crypto.X509Utilities import net.corda.core.crypto.generateKeyPair import net.corda.node.services.identity.InMemoryIdentityService import net.corda.core.utilities.ALICE @@ -50,9 +51,10 @@ class InMemoryIdentityServiceTests { @Test fun `get identity by name`() { val service = InMemoryIdentityService() - val identities = listOf("Node A", "Node B", "Node C").map { Party(it, generateKeyPair().public) } + val identities = listOf("Node A", "Node B", "Node C") + .map { Party("CN=$it,O=R3,OU=corda,L=London,C=UK", generateKeyPair().public) } assertNull(service.partyFromName(identities.first().name)) identities.forEach { service.registerIdentity(it) } identities.forEach { assertEquals(it, service.partyFromName(it.name)) } } -} \ No newline at end of file +} diff --git a/node/src/test/kotlin/net/corda/node/services/network/InMemoryNetworkMapCacheTest.kt b/node/src/test/kotlin/net/corda/node/services/network/InMemoryNetworkMapCacheTest.kt index 845e5d388c..cbcf699c36 100644 --- a/node/src/test/kotlin/net/corda/node/services/network/InMemoryNetworkMapCacheTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/network/InMemoryNetworkMapCacheTest.kt @@ -2,6 +2,8 @@ package net.corda.node.services.network import net.corda.core.getOrThrow import net.corda.core.node.services.ServiceInfo +import net.corda.core.utilities.ALICE +import net.corda.core.utilities.BOB import net.corda.node.utilities.transaction import net.corda.testing.node.MockNetwork import org.junit.Test @@ -22,8 +24,8 @@ class InMemoryNetworkMapCacheTest { @Test fun `key collision`() { val entropy = BigInteger.valueOf(24012017L) - val nodeA = network.createNode(null, -1, MockNetwork.DefaultFactory, true, "Node A", null, entropy, ServiceInfo(NetworkMapService.type)) - val nodeB = network.createNode(null, -1, MockNetwork.DefaultFactory, true, "Node B", null, entropy, ServiceInfo(NetworkMapService.type)) + val nodeA = network.createNode(null, -1, MockNetwork.DefaultFactory, true, ALICE.name, null, entropy, ServiceInfo(NetworkMapService.type)) + val nodeB = network.createNode(null, -1, MockNetwork.DefaultFactory, true, BOB.name, null, entropy, ServiceInfo(NetworkMapService.type)) assertEquals(nodeA.info.legalIdentity, nodeB.info.legalIdentity) // Node A currently knows only about itself, so this returns node A diff --git a/node/src/test/kotlin/net/corda/node/services/statemachine/StateMachineManagerTests.kt b/node/src/test/kotlin/net/corda/node/services/statemachine/StateMachineManagerTests.kt index e24318fde1..cc5c5f2b03 100644 --- a/node/src/test/kotlin/net/corda/node/services/statemachine/StateMachineManagerTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/statemachine/StateMachineManagerTests.kt @@ -8,6 +8,7 @@ import net.corda.core.* import net.corda.core.contracts.DOLLARS import net.corda.core.contracts.DummyState import net.corda.core.crypto.Party +import net.corda.core.crypto.X509Utilities import net.corda.core.crypto.generateKeyPair import net.corda.core.flows.FlowException import net.corda.core.flows.FlowLogic @@ -73,12 +74,12 @@ class StateMachineManagerTests { node1 = nodes.first node2 = nodes.second val notaryKeyPair = generateKeyPair() - val notaryService = ServiceInfo(ValidatingNotaryService.type, "notary-service-2000") + val notaryService = ServiceInfo(ValidatingNotaryService.type, "CN=notary-service-2000,O=R3,OU=corda,L=London,C=UK") val overrideServices = mapOf(Pair(notaryService, notaryKeyPair)) // Note that these notaries don't operate correctly as they don't share their state. They are only used for testing // service addressing. - notary1 = net.createNotaryNode(networkMapAddr = node1.services.myInfo.address, overrideServices = overrideServices, serviceName = "notary-service-2000") - notary2 = net.createNotaryNode(networkMapAddr = node1.services.myInfo.address, overrideServices = overrideServices, serviceName = "notary-service-2000") + notary1 = net.createNotaryNode(networkMapAddr = node1.services.myInfo.address, overrideServices = overrideServices, serviceName = notaryService.name) + notary2 = net.createNotaryNode(networkMapAddr = node1.services.myInfo.address, overrideServices = overrideServices, serviceName = notaryService.name) net.messagingNetwork.receivedMessages.toSessionTransfers().forEach { sessionTransfers += it } net.runNetwork() diff --git a/node/src/test/kotlin/net/corda/node/utilities/registration/NetworkisRegistrationHelperTest.kt b/node/src/test/kotlin/net/corda/node/utilities/registration/NetworkisRegistrationHelperTest.kt index 5772af6a96..e465a3c53a 100644 --- a/node/src/test/kotlin/net/corda/node/utilities/registration/NetworkisRegistrationHelperTest.kt +++ b/node/src/test/kotlin/net/corda/node/utilities/registration/NetworkisRegistrationHelperTest.kt @@ -6,6 +6,7 @@ import com.nhaarman.mockito_kotlin.mock import net.corda.core.crypto.SecureHash import net.corda.core.crypto.X509Utilities import net.corda.core.exists +import net.corda.core.utilities.ALICE import net.corda.testing.TestNodeConfiguration import org.junit.Rule import org.junit.Test @@ -34,7 +35,7 @@ class NetworkRegistrationHelperTest { val config = TestNodeConfiguration( baseDirectory = tempFolder.root.toPath(), - myLegalName = "me", + myLegalName = ALICE.name, networkMapService = null) assertFalse(config.keyStoreFile.exists()) diff --git a/samples/attachment-demo/build.gradle b/samples/attachment-demo/build.gradle index 53d6d67d30..c6cdd6c3c3 100644 --- a/samples/attachment-demo/build.gradle +++ b/samples/attachment-demo/build.gradle @@ -55,9 +55,9 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["StartFlow.net.corda.flows.FinalityFlow"]]] directory "./build/nodes" - networkMap "Controller" + networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" node { - name "Controller" + name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices["corda.notary.validating"] p2pPort 10002 @@ -66,7 +66,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { rpcUsers = ext.rpcUsers } node { - name "Bank A" + name "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10005 @@ -75,7 +75,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { rpcUsers = ext.rpcUsers } node { - name "Bank B" + name "CN=Bank B,O=Bank B,L=New York,C=USA" nearestCity "New York" advertisedServices = [] p2pPort 10008 diff --git a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt index f9aa80867c..a4279be5ab 100644 --- a/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt +++ b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt @@ -13,6 +13,7 @@ import net.corda.core.getOrThrow import net.corda.core.messaging.CordaRPCOps import net.corda.core.messaging.startTrackedFlow import net.corda.core.sizedInputStreamAndHash +import net.corda.core.utilities.DUMMY_BANK_B import net.corda.core.utilities.DUMMY_NOTARY import net.corda.core.utilities.DUMMY_NOTARY_KEY import net.corda.core.utilities.Emoji @@ -66,7 +67,7 @@ fun sender(rpc: CordaRPCOps, numOfClearBytes: Int = 1024) { // default size 1K. fun sender(rpc: CordaRPCOps, inputStream: InputStream, hash: SecureHash.SHA256) { // Get the identity key of the other side (the recipient). - val otherSide: Party = rpc.partyFromName("Bank B")!! + val otherSide: Party = rpc.partyFromName(DUMMY_BANK_B.name) ?: throw IllegalStateException("Could not find counterparty \"${DUMMY_BANK_B.name}\"") // Make sure we have the file in storage if (!rpc.attachmentExists(hash)) { @@ -133,4 +134,4 @@ class AttachmentContract : Contract { override val contract: Contract = AttachmentContract() override val participants: List = emptyList() } -} \ No newline at end of file +} diff --git a/samples/bank-of-corda-demo/README.md b/samples/bank-of-corda-demo/README.md index 4c81eec7f9..54d30376fe 100644 --- a/samples/bank-of-corda-demo/README.md +++ b/samples/bank-of-corda-demo/README.md @@ -44,7 +44,7 @@ The RPC API requires a client to pass in user credentials: client.start("bankUser","test") which are validated on the Bank of Corda node against those configured at node startup: User("bankUser", "test", permissions = setOf(startFlowPermission())) - startNode("BankOfCorda", rpcUsers = listOf(user)) + startNode(BOC.name, rpcUsers = listOf(user)) Notary We are using a [SimpleNotaryService] in this example, but could easily switch to a [ValidatingNotaryService] diff --git a/samples/bank-of-corda-demo/build.gradle b/samples/bank-of-corda-demo/build.gradle index 8991a95b1d..8518d09b0c 100644 --- a/samples/bank-of-corda-demo/build.gradle +++ b/samples/bank-of-corda-demo/build.gradle @@ -52,9 +52,9 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" // This name "Notary" is hard-coded into BankOfCordaClientApi so if you change it here, change it there too. // In this demo the node that runs a standalone notary also acts as the network map server. - networkMap "Notary" + networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" node { - name "Notary" + name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = ["corda.notary.validating"] p2pPort 10002 @@ -62,8 +62,8 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { cordapps = [] } node { - name "BankOfCorda" - nearestCity "London" + name "CN=BankOfCorda,O=R3,OU=corda,L=New York,C=USA" + nearestCity "New York" advertisedServices = ["corda.issuer.USD"] p2pPort 10005 rpcPort 10006 @@ -77,7 +77,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { ] } node { - name "BigCorporation" + name "CN=BigCorporation,O=R3,OU=corda,L=London,C=UK" nearestCity "New York" advertisedServices = [] p2pPort 10008 diff --git a/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaHttpAPITest.kt b/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaHttpAPITest.kt index 808761c166..a7d5153e19 100644 --- a/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaHttpAPITest.kt +++ b/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaHttpAPITest.kt @@ -16,10 +16,10 @@ class BankOfCordaHttpAPITest { driver(dsl = { val (nodeBankOfCorda) = Futures.allAsList( startNode(BOC.name, setOf(ServiceInfo(SimpleNotaryService.type))), - startNode("BigCorporation") + startNode(BIGCORP_LEGAL_NAME) ).getOrThrow() val nodeBankOfCordaApiAddr = startWebserver(nodeBankOfCorda).getOrThrow().listenAddress - assert(BankOfCordaClientApi(nodeBankOfCordaApiAddr).requestWebIssue(IssueRequestParams(1000, "USD", "BigCorporation", "1", BOC.name))) + assert(BankOfCordaClientApi(nodeBankOfCordaApiAddr).requestWebIssue(IssueRequestParams(1000, "USD", BIGCORP_LEGAL_NAME, "1", BOC.name))) }, isDebug = true) } } diff --git a/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaRPCClientTest.kt b/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaRPCClientTest.kt index 39b0112811..6ebc80facb 100644 --- a/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaRPCClientTest.kt +++ b/samples/bank-of-corda-demo/src/integration-test/kotlin/net/corda/bank/BankOfCordaRPCClientTest.kt @@ -21,7 +21,7 @@ class BankOfCordaRPCClientTest { val bigCorpCFO = User("bigCorpCFO", "password2", permissions = emptySet()) val (nodeBankOfCorda, nodeBigCorporation) = Futures.allAsList( startNode(BOC.name, setOf(ServiceInfo(SimpleNotaryService.type)), listOf(bocManager)), - startNode("BigCorporation", rpcUsers = listOf(bigCorpCFO)) + startNode(BIGCORP_LEGAL_NAME, rpcUsers = listOf(bigCorpCFO)) ).getOrThrow() // Bank of Corda RPC Client diff --git a/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt b/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt index e071560df0..277842d214 100644 --- a/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt +++ b/samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaDriver.kt @@ -4,6 +4,7 @@ import com.google.common.net.HostAndPort import joptsimple.OptionParser import net.corda.bank.api.BankOfCordaClientApi import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams +import net.corda.core.crypto.X509Utilities import net.corda.core.node.services.ServiceInfo import net.corda.core.node.services.ServiceType import net.corda.core.transactions.SignedTransaction @@ -27,6 +28,8 @@ fun main(args: Array) { val BANK_USERNAME = "bankUser" val BIGCORP_USERNAME = "bigCorpUser" +val BIGCORP_LEGAL_NAME = "CN=BigCorporation,O=R3,OU=corda,L=London,C=UK" + private class BankOfCordaDriver { enum class Role { ISSUE_CASH_RPC, @@ -57,13 +60,13 @@ private class BankOfCordaDriver { val bigCorpUser = User(BIGCORP_USERNAME, "test", permissions = setOf(startFlowPermission())) startNode(DUMMY_NOTARY.name, setOf(ServiceInfo(SimpleNotaryService.type))) val bankOfCorda = startNode(BOC.name, rpcUsers = listOf(bankUser), advertisedServices = setOf(ServiceInfo(ServiceType.corda.getSubType("issuer.USD")))) - startNode("BigCorporation", rpcUsers = listOf(bigCorpUser)) + startNode(BIGCORP_LEGAL_NAME, rpcUsers = listOf(bigCorpUser)) startWebserver(bankOfCorda.get()) waitForAllNodesToFinish() }, isDebug = true) } else { try { - val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), "BigCorporation", "1", "BankOfCorda") + val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), BIGCORP_LEGAL_NAME, "1", BOC.name) when (role) { Role.ISSUE_CASH_RPC -> { println("Requesting Cash via RPC ...") diff --git a/samples/irs-demo/build.gradle b/samples/irs-demo/build.gradle index f8a83dbf49..67c1855e79 100644 --- a/samples/irs-demo/build.gradle +++ b/samples/irs-demo/build.gradle @@ -57,9 +57,9 @@ dependencies { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "Notary" + networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" node { - name "Notary" + name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = ["corda.notary.validating", "corda.interest_rates"] p2pPort 10002 @@ -69,7 +69,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { useTestClock true } node { - name "Bank A" + name "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10005 @@ -79,7 +79,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { useTestClock true } node { - name "Bank B" + name "CN=Bank B,O=Bank B,L=New York,C=USA" nearestCity "New York" advertisedServices = [] p2pPort 10008 diff --git a/samples/irs-demo/src/main/kotlin/net/corda/simulation/Simulation.kt b/samples/irs-demo/src/main/kotlin/net/corda/simulation/Simulation.kt index 2ccca41c29..694c9f117a 100644 --- a/samples/irs-demo/src/main/kotlin/net/corda/simulation/Simulation.kt +++ b/samples/irs-demo/src/main/kotlin/net/corda/simulation/Simulation.kt @@ -2,6 +2,7 @@ package net.corda.simulation import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.ListenableFuture +import net.corda.core.crypto.X509Utilities import net.corda.core.flatMap import net.corda.core.flows.FlowLogic import net.corda.core.messaging.SingleMessageRecipient @@ -70,7 +71,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, val cfg = TestNodeConfiguration( baseDirectory = config.baseDirectory, // TODO: Set this back to "Bank of $city" after video day. - myLegalName = "Bank $letter", + myLegalName = "CN=Bank $letter,O=Bank $letter,L=city", nearestCity = city, networkMapService = null) return SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) @@ -121,7 +122,8 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, require(advertisedServices.containsType(NodeInterestRates.type)) val cfg = TestNodeConfiguration( baseDirectory = config.baseDirectory, - myLegalName = "Rates Service Provider", + // TODO: Make a more realistic legal name + myLegalName = "CN=Rates Service Provider,O=R3,OU=corda,L=London,C=UK", nearestCity = "Madrid", networkMapService = null) return object : SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) { @@ -144,7 +146,8 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean, entropyRoot: BigInteger): MockNetwork.MockNode { val cfg = TestNodeConfiguration( baseDirectory = config.baseDirectory, - myLegalName = "Regulator A", + // TODO: Make a more realistic legal name + myLegalName = "Regulator A,O=R3,OU=corda,L=London,C=UK", nearestCity = "Paris", networkMapService = null) return object : SimulatedNode(cfg, network, networkMapAddr, advertisedServices, id, overrideServices, entropyRoot) { diff --git a/samples/irs-demo/src/main/resources/example-irs-trade.json b/samples/irs-demo/src/main/resources/example-irs-trade.json index 60a3c65268..4daa6842f6 100644 --- a/samples/irs-demo/src/main/resources/example-irs-trade.json +++ b/samples/irs-demo/src/main/resources/example-irs-trade.json @@ -1,6 +1,6 @@ { "fixedLeg": { - "fixedRatePayer": "Bank A", + "fixedRatePayer": "CN=Bank A,O=Bank A,L=London,C=UK", "notional": "€25000000", "paymentFrequency": "SemiAnnual", "effectiveDate": "2016-03-11", @@ -22,7 +22,7 @@ "interestPeriodAdjustment": "Adjusted" }, "floatingLeg": { - "floatingRatePayer": "Bank B", + "floatingRatePayer": "CN=Bank B,O=Bank B,L=New York,C=USA", "notional": "€25000000", "paymentFrequency": "Quarterly", "effectiveDate": "2016-03-11", diff --git a/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FixedLeg.js b/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FixedLeg.js index 7773d85568..0fb73960ee 100644 --- a/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FixedLeg.js +++ b/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FixedLeg.js @@ -2,7 +2,7 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => { return { - fixedRatePayer: "Bank A", + fixedRatePayer: "CN=Bank A,O=Bank A,L=London,C=UK", notional: { quantity: 2500000000 }, @@ -17,4 +17,4 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => { paymentDelay: "0", interestPeriodAdjustment: "Adjusted" }; -}); \ No newline at end of file +}); diff --git a/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FloatingLeg.js b/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FloatingLeg.js index 2489b83cab..1cc612ea41 100644 --- a/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FloatingLeg.js +++ b/samples/irs-demo/src/main/resources/irsweb/js/viewmodel/FloatingLeg.js @@ -2,7 +2,7 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => { return { - floatingRatePayer: "Bank B", + floatingRatePayer: "CN=Bank B,O=Bank B,L=New York,C=USA", notional: { quantity: 2500000000 }, @@ -25,4 +25,4 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => { name: "3M" } }; -}); \ No newline at end of file +}); diff --git a/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/NodeInterestRatesTest.kt b/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/NodeInterestRatesTest.kt index 79a4bcd524..fa7b573ed2 100644 --- a/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/NodeInterestRatesTest.kt +++ b/samples/irs-demo/src/test/kotlin/net/corda/irs/testing/NodeInterestRatesTest.kt @@ -8,6 +8,7 @@ import net.corda.core.bd import net.corda.core.contracts.* import net.corda.core.crypto.MerkleTreeException import net.corda.core.crypto.Party +import net.corda.core.crypto.X509Utilities import net.corda.core.crypto.generateKeyPair import net.corda.core.getOrThrow import net.corda.core.node.services.ServiceInfo @@ -47,7 +48,7 @@ class NodeInterestRatesTest { """.trimIndent()) val DUMMY_CASH_ISSUER_KEY = generateKeyPair() - val DUMMY_CASH_ISSUER = Party("Cash issuer", DUMMY_CASH_ISSUER_KEY.public) + val DUMMY_CASH_ISSUER = Party("CN=Cash issuer,O=R3,OU=corda,L=London,C=UK", DUMMY_CASH_ISSUER_KEY.public) val clock = Clock.systemUTC() lateinit var oracle: NodeInterestRates.Oracle diff --git a/samples/raft-notary-demo/build.gradle b/samples/raft-notary-demo/build.gradle index b022cd307f..3601a446ae 100644 --- a/samples/raft-notary-demo/build.gradle +++ b/samples/raft-notary-demo/build.gradle @@ -75,9 +75,9 @@ task generateNotaryIdentity(type: JavaExec) { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', 'generateNotaryIdentity']) { directory deployTo - networkMap "Notary 1" + networkMap "CN=Notary 1,O=R3,OU=corda,L=London,C=UK" node { - name "Party" + name "CN=Party,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10002 @@ -89,7 +89,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', 'generateN ]]] } node { - name "Counterparty" + name "CN=Counterparty,O=R3,OU=corda,L=London,C=UK" nearestCity "New York" advertisedServices = [] p2pPort 10005 @@ -97,7 +97,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', 'generateN cordapps = [] } node { - name "Notary 1" + name "CN=Notary 1,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [advertisedNotary] p2pPort 10008 @@ -106,7 +106,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', 'generateN notaryNodePort 11002 } node { - name "Notary 2" + name "CN=Notary 2,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [advertisedNotary] p2pPort 10011 @@ -116,7 +116,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', 'generateN notaryClusterAddresses = ["localhost:11002"] } node { - name "Notary 3" + name "CN=Notary 3,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = [advertisedNotary] p2pPort 10014 diff --git a/samples/simm-valuation-demo/build.gradle b/samples/simm-valuation-demo/build.gradle index da40e97a86..eef18c04ba 100644 --- a/samples/simm-valuation-demo/build.gradle +++ b/samples/simm-valuation-demo/build.gradle @@ -68,16 +68,16 @@ dependencies { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "Controller" + networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" node { - name "Controller" + name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = ["corda.notary.validating"] p2pPort 10002 cordapps = [] } node { - name "Bank A" + name "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10004 @@ -85,7 +85,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { cordapps = [] } node { - name "Bank B" + name "CN=Bank B,O=Bank B,L=New York,C=USA" nearestCity "New York" advertisedServices = [] p2pPort 10006 @@ -93,8 +93,8 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { cordapps = [] } node { - name "Bank C" - nearestCity "tokyo" + name "CN=Bank C,O=Bank C,L=Tokyo,C=Japan" + nearestCity "Tokyo" advertisedServices = [] p2pPort 10008 webPort 10009 diff --git a/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FixedLegViewModel.js b/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FixedLegViewModel.js index b5895dcce8..f429b39945 100644 --- a/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FixedLegViewModel.js +++ b/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FixedLegViewModel.js @@ -1,7 +1,7 @@ "use strict"; var FixedLegViewModel = (function () { function FixedLegViewModel() { - this.fixedRatePayer = "Bank A"; + this.fixedRatePayer = "CN=Bank A,O=Bank A,L=London,C=UK"; this.notional = { quantity: 2500000000 }; @@ -17,4 +17,4 @@ var FixedLegViewModel = (function () { return FixedLegViewModel; }()); exports.FixedLegViewModel = FixedLegViewModel; -//# sourceMappingURL=FixedLegViewModel.js.map \ No newline at end of file +//# sourceMappingURL=FixedLegViewModel.js.map diff --git a/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FloatingLegViewModel.js b/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FloatingLegViewModel.js index 99f89a894b..4931c75fee 100644 --- a/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FloatingLegViewModel.js +++ b/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/viewmodel/FloatingLegViewModel.js @@ -1,7 +1,7 @@ "use strict"; var FloatingLegViewModel = (function () { function FloatingLegViewModel() { - this.floatingRatePayer = "Bank B"; + this.floatingRatePayer = "CN=Bank B,O=Bank B,L=New York,C=USA"; this.notional = { quantity: 2500000000 }; @@ -25,4 +25,4 @@ var FloatingLegViewModel = (function () { return FloatingLegViewModel; }()); exports.FloatingLegViewModel = FloatingLegViewModel; -//# sourceMappingURL=FloatingLegViewModel.js.map \ No newline at end of file +//# sourceMappingURL=FloatingLegViewModel.js.map diff --git a/samples/simm-valuation-demo/src/main/web/src/app/viewmodel/FloatingLegViewModel.ts b/samples/simm-valuation-demo/src/main/web/src/app/viewmodel/FloatingLegViewModel.ts index 92f0075b2b..899a01b07e 100644 --- a/samples/simm-valuation-demo/src/main/web/src/app/viewmodel/FloatingLegViewModel.ts +++ b/samples/simm-valuation-demo/src/main/web/src/app/viewmodel/FloatingLegViewModel.ts @@ -1,7 +1,7 @@ export class FloatingLegViewModel { constructor() { } - floatingRatePayer = "Bank B"; + floatingRatePayer = "CN=Bank B,O=Bank B,L=New York,C=USA"; notional: Object = { quantity: 2500000000 }; diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index 3c893998ab..09c765cc2a 100644 --- a/samples/trader-demo/build.gradle +++ b/samples/trader-demo/build.gradle @@ -68,16 +68,16 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" // This name "Notary" is hard-coded into TraderDemoClientApi so if you change it here, change it there too. // In this demo the node that runs a standalone notary also acts as the network map server. - networkMap "Notary" + networkMap "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" node { - name "Notary" + name "CN=Notary Service,O=R3,OU=corda,L=London,C=UK" nearestCity "London" advertisedServices = ["corda.notary.validating"] p2pPort 10002 cordapps = [] } node { - name "Bank A" + name "CN=Bank A,O=Bank A,L=London,C=UK" nearestCity "London" advertisedServices = [] p2pPort 10005 @@ -86,7 +86,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { rpcUsers = ext.rpcUsers } node { - name "Bank B" + name "CN=Bank B,O=Bank B,L=New York,C=USA" nearestCity "New York" advertisedServices = [] p2pPort 10008 @@ -95,7 +95,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { rpcUsers = ext.rpcUsers } node { - name "BankOfCorda" + name "CN=BankOfCorda,O=R3,OU=corda,L=New York,C=USA" nearestCity "London" advertisedServices = [] p2pPort 10011 diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt index 2eeb1aef25..8966a46b7f 100644 --- a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt +++ b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt @@ -48,7 +48,7 @@ private class TraderDemo { } else { val host = HostAndPort.fromString("localhost:10009") CordaRPCClient(host).use("demo", "demo") { - TraderDemoClientApi(this).runSeller(1000.DOLLARS, "Bank A") + TraderDemoClientApi(this).runSeller(1000.DOLLARS, "CN=Bank A,O=Bank A,L=London,C=UK") } } } diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt index e5dae733d4..76042a5eb2 100644 --- a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt +++ b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/flow/SellerFlow.kt @@ -4,12 +4,15 @@ import co.paralleluniverse.fibers.Suspendable import net.corda.contracts.CommercialPaper import net.corda.contracts.asset.DUMMY_CASH_ISSUER import net.corda.core.contracts.* -import net.corda.core.crypto.* +import net.corda.core.crypto.Party +import net.corda.core.crypto.SecureHash +import net.corda.core.crypto.generateKeyPair import net.corda.core.days import net.corda.core.flows.FlowLogic import net.corda.core.node.NodeInfo import net.corda.core.seconds import net.corda.core.transactions.SignedTransaction +import net.corda.core.utilities.DUMMY_BANK_C import net.corda.core.utilities.ProgressTracker import net.corda.flows.NotaryFlow import net.corda.flows.TwoPartyTradeFlow @@ -63,7 +66,7 @@ class SellerFlow(val otherParty: Party, fun selfIssueSomeCommercialPaper(ownedBy: PublicKey, notaryNode: NodeInfo): StateAndRef { // Make a fake company that's issued its own paper. val keyPair = generateKeyPair() - val party = Party("Bank of London", keyPair.public) + val party = Party(DUMMY_BANK_C.name, keyPair.public) val issuance: SignedTransaction = run { val tx = CommercialPaper().generateIssue(party.ref(1, 2, 3), 1100.DOLLARS `issued by` DUMMY_CASH_ISSUER, diff --git a/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt b/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt index 1bf2eeda3f..ce4507d75c 100644 --- a/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt +++ b/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt @@ -71,7 +71,7 @@ val MINI_CORP: Party get() = Party("MiniCorp", MINI_CORP_PUBKEY) val BOC_KEY: KeyPair by lazy { generateKeyPair() } val BOC_PUBKEY: PublicKey get() = BOC_KEY.public -val BOC: Party get() = Party("BankOfCorda", BOC_PUBKEY) +val BOC: Party get() = Party("CN=BankOfCorda,O=R3,OU=corda,L=New York,C=USA", BOC_PUBKEY) val BOC_PARTY_REF = BOC.ref(OpaqueBytes.of(1)).reference val BIG_CORP_KEY: KeyPair by lazy { generateKeyPair() } diff --git a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt index d328024cb5..138dea1d6d 100644 --- a/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt +++ b/tools/demobench/src/test/kotlin/net/corda/demobench/model/NodeConfigTest.kt @@ -160,7 +160,7 @@ class NodeConfigTest { + "\"h2port\":30001," + "\"myLegalName\":\"MyName\"," + "\"nearestCity\":\"Stockholm\"," - + "\"networkMapService\":{\"address\":\"localhost:12345\",\"legalName\":\"NotaryService\"}," + + "\"networkMapService\":{\"address\":\"localhost:12345\",\"legalName\":\"CN=NotaryService,O=R3,OU=corda,L=London,C=UK\"}," + "\"p2pAddress\":\"localhost:10001\"," + "\"rpcAddress\":\"localhost:40002\"," + "\"rpcUsers\":["