gpt4 book ai didi

x509certificate - 如何在Corda中手动生成网络参数

转载 作者:行者123 更新时间:2023-12-04 02:49:25 25 4
gpt4 key购买 nike

我已经手动创建并分发了 Corda 节点所需的证书。现在要启动节点,除其他外,它们需要有一个网络参数。问题是,如果我使用 Corda 网络 Bootstrap 工具生成网络参数,该文件将由另一个发行者签名(“C=UK,L=London,OU=corda,O=R3,CN=Corda Node Root CA ") 这与我的证书的颁发者不同。我的问题是如何手动创建网络参数以便指定正确的发行者以避免在节点启动期间发生冲突?

enter image description here

最佳答案

所以我想出了一种创建网络参数的方法:

private fun getSignedNetworkParameters(): NetworkParameters {

//load the notary from a Keystore. This avoids having to start a flow from a node in order to retrieve NotaryInfo
val notary = loadKeyStore("\\path-to-keystore\\keystore.jks", "keystore-password")

val certificateAndKeyPair : CertificateAndKeyPair = notary.getCertificateAndKeyPair("entry-alias", "entry-password")
val notaryParty = Party(certificateAndKeyPair.certificate)
val notaryInfo = listOf(NotaryInfo(notaryParty, false))

//map contract ID to the SHA-256 hash of its CorDapp contracts&states JAR file
val whitelistedContractImplementations = mapOf(
TestContract.TEST_CONTRACT_ID to listOf(getCheckSum(contractFile))
)

return NetworkParameters(minimumPlatformVersion = 3, notaries = notaryInfo,
maxMessageSize = n, maxTransactionSize = n, modifiedTime = Instant.now(),
epoch = 1, whitelistedContractImplementations = whitelistedContractImplementations)
}

关于x509certificate - 如何在Corda中手动生成网络参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55743730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com