尝试部署节点时出错:“java.lang.IllegalArgumentException:无法识别的算法:1.2.840.10040.4.1”

时间:2018-02-01 11:10:20

标签: corda

我开发了Cordapp并尝试将其作为节点部署到我的工作站。

我按照说明https://docs.corda.net/deploying-a-node.html#windows-installing-and-running-corda-as-a-windows-service

服务启动后,server.log会生成以下错误消息:

   ______               __
  / ____/     _________/ /___ _
 / /     __  / ___/ __  / __ `/         Computer science and finance together.
/ /___  /_/ / /  / /_/ / /_/ /          You should see our crazy Christmas parties!
\____/     /_/   \__,_/\__,_/

--- Corda Open Source 2.0.0 (f91995b) -----------------------------------------------



Logs can be found in                    : C:\Corda\logs
Database connection url is              : jdbc:h2:tcp://192.168.1.211:11000/node
[1;31mE 16:16:20+0800 [main] internal.Node.run - Exception during node startup
[m java.lang.IllegalArgumentException: Unrecognised algorithm: 1.2.840.10040.4.1
    at net.corda.core.crypto.Crypto.findSignatureScheme(Crypto.kt:237) ~[corda-core-2.0.0.jar:?]
    at net.corda.core.crypto.Crypto.decodePublicKey(Crypto.kt:344) ~[corda-core-2.0.0.jar:?]
    at net.corda.core.crypto.Crypto.toSupportedPublicKey(Crypto.kt:932) ~[corda-core-2.0.0.jar:?]
    at net.corda.node.utilities.KeyStoreUtilities.getCertificateAndKeyPair(KeyStoreUtilities.kt:139) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.utilities.KeyStoreWrapper.certificateAndKeyPair(KeyStoreUtilities.kt:211) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.utilities.KeyStoreWrapper.createCertificate(KeyStoreUtilities.kt:179) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.utilities.KeyStoreWrapper.signAndSaveNewKeyPair(KeyStoreUtilities.kt:189) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode.obtainIdentity(AbstractNode.kt:652) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode.obtainIdentity$default(AbstractNode.kt:630) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode.makeServices(AbstractNode.kt:387) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode.access$makeServices(AbstractNode.kt:99) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode$start$startedImpl$1.invoke(AbstractNode.kt:185) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode$start$startedImpl$1.invoke(AbstractNode.kt:99) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode$initialiseDatabasePersistence$6.invoke(AbstractNode.kt:484) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode$initialiseDatabasePersistence$6.invoke(AbstractNode.kt:99) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.utilities.CordaPersistence.inTopLevelTransaction(CordaPersistence.kt:84) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.utilities.CordaPersistence.transaction(CordaPersistence.kt:75) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.utilities.CordaPersistence.transaction(CordaPersistence.kt:65) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode.initialiseDatabasePersistence(AbstractNode.kt:483) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.Node.initialiseDatabasePersistence(Node.kt:302) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:184) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.Node.start(Node.kt:312) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:95) ~[corda-node-2.0.0.jar:?]
    at net.corda.node.internal.NodeStartup.run(NodeStartup.kt:74) [corda-node-2.0.0.jar:?]
    at net.corda.node.Corda.main(Corda.kt:11) [corda-node-2.0.0.jar:?]

之后,程序自行终止,然后立即重启,再次输出错误并终止......无限重复。

我迷失了,因此任何帮助或方向都会如此之大。谢谢!

更新我的密钥库生成过程

我发现它可能是我的密钥库上的一个问题。以下是我用于使用Java keytool生成3个必需密钥库的命令行。

keytool -genkeypair -keyalg RSA -keystore root.jks -dname "CN=My Organization, OU=Development, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -storepass password -keypass password -alias root -ext bc:c

keytool -keystore root.jks -storepass password -alias root -exportcert -rfc > root.pem

keytool -importkeystore -srckeystore root.jks -destkeystore truststore.jks -srcstorepass password -deststorepass password -srcalias root -destalias cordarootca

keytool -genkeypair -keyalg RSA -keystore intermediate.jks -dname "CN=My Organization, OU=Development, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -storepass password -keypass password -alias intermediate -ext bc:c

keytool -keystore intermediate.jks -storepass password -alias intermediate -certreq | keytool -keystore root.jks -storepass password -alias root -gencert -ext bc:c -rfc > intermediate.pem

type root.pem intermediate.pem > intermediatecachain.pem

keytool -keystore intermediate.jks -storepass password -alias intermediate -importcert -file intermediatecachain.pem -noprompt

keytool -keystore intermediate.jks -storepass password -alias intermediate -exportcert -rfc > intermediate.pem

keytool -genkeypair -keyalg RSA -keystore nodekeystore.jks -dname "CN=My Organization, OU=Development, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -alias cordaclientca -storepass password -keypass password -ext bc:c

keytool -keystore nodekeystore.jks -storepass password -alias cordaclientca -certreq | keytool -keystore intermediate.jks -storepass password -alias intermediate -gencert -ext bc:c -rfc > cordaclientca.pem

type intermediate.pem cordaclientca.pem > cordaclientcachain.pem

keytool -keystore nodekeystore.jks -storepass password -alias cordaclientca -importcert -file cordaclientcachain.pem -noprompt

keytool -genkeypair -keyalg RSA -keystore sslkeystore.jks -dname "CN=My Organization, OU=Development, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -alias cordaclientttls -storepass password -keypass password

keytool -keystore sslkeystore.jks -storepass password -alias cordaclienttls -certreq | keytool -keystore intermediate.jks -storepass password -alias intermediate -gencert -ext bc:0 -rfc > cordaclienttls.pem

type intermediate.pem cordaclienttls.pem > cordaclienttlschain.pem

keytool -keystore sslkeystore.jks -storepass password -alias cordaclienttls -importcert -file cordaclienttlschain.pem -noprompt

更新#2

我在生成密钥库时犯了错误。我发布修改后的命令行作为答案。但是,当我尝试使用新的密钥库进行部署时,会出现新的错误消息。新问题链接:Error when try to deploy a node: "java.security.NoSuchAlgorithmException: 1.2.840.113549.1.1.1 Signature not available"

1 个答案:

答案 0 :(得分:2)

最后,我在生成密钥时出错了。使用以下命令行,我可以正确生成具有RSA密钥算法的所有密钥库。使用这些新的密钥库,错误消失。

keytool -genkeypair -keyalg RSA -keystore root.jks -dname "OU=ID, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -storepass password -keypass password -alias root -ext bc:c
keytool -keystore root.jks -storepass password -alias root -exportcert -rfc > root.pem
keytool -importkeystore -srckeystore root.jks -destkeystore truststore.jks -srcstorepass password -deststorepass password -srcalias root -destalias cordarootca

keytool -genkeypair -keyalg RSA -keystore intermediate.jks -dname "OU=ID, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -storepass password -keypass password -alias intermediate -ext bc:c
keytool -keystore intermediate.jks -storepass password -alias intermediate -certreq | keytool -keystore root.jks -storepass password -alias root -gencert -ext bc:c -rfc > intermediate.pem
type root.pem intermediate.pem > intermediatecachain.pem
keytool -keystore intermediate.jks -storepass password -alias intermediate -importcert -file 
intermediatecachain.pem -noprompt
keytool -keystore intermediate.jks -storepass password -alias intermediate -exportcert -rfc > intermediate.pem

keytool -genkeypair -keyalg RSA -keystore nodekeystore.jks -dname "OU=ID, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -alias cordaclientca -storepass password -keypass password -ext bc:c
keytool -keystore nodekeystore.jks -storepass password -alias cordaclientca -certreq | keytool -keystore intermediate.jks -storepass password -alias intermediate -gencert -ext bc:c -rfc > cordaclientca.pem
type intermediate.pem cordaclientca.pem > cordaclientcachain.pem
keytool -keystore nodekeystore.jks -storepass password -alias cordaclientca -importcert -file cordaclientcachain.pem -noprompt

keytool -genkeypair -keyalg RSA -keystore sslkeystore.jks -dname "OU=ID, O=My Organization, L=Hong Kong, ST=Hong Kong, C=HK" -alias cordaclienttls -storepass password -keypass password
keytool -keystore sslkeystore.jks -storepass password -alias cordaclienttls -certreq | keytool -keystore intermediate.jks -storepass password -alias intermediate -gencert -ext bc:0 -rfc > cordaclienttls.pem
type intermediate.pem cordaclienttls.pem > cordaclienttlschain.pem
keytool -keystore sslkeystore.jks -storepass password -alias cordaclienttls -importcert -file cordaclienttlschain.pem -noprompt