Error when try to deploy a node: “java.lang.IllegalArgumentException: Unrecognised algorithm: 1.2.840.10040.4.1”

妖精的绣舞 提交于 2019-12-09 19:36:29

问题


I developed a Cordapp and tried to deploy it to my workstation as a node.

I followed instruction https://docs.corda.net/deploying-a-node.html#windows-installing-and-running-corda-as-a-windows-service

After service starts, a server.log generates the following error message:

   ______               __
  / ____/     _________/ /___ _
 / /     __  / ___/ __  / __ `/         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:?]

After that, procedure terminates itself, and then restart immediately, and again outputs error and terminates... repeat infinitely.

I am so lost and thus any help or direction would be so great. Thanks!

Update on my keystore generate procedure

I figure out that it could be an issue on my keystores. The following is the command lines I used to generate 3 required keystore with Java keytool.

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

Update #2

It is my mistake on generating keystores. I post my revised command lines as the answer. However new error message then comes out when I try to deploy with new keystore. New question link: Error when try to deploy a node: "java.security.NoSuchAlgorithmException: 1.2.840.113549.1.1.1 Signature not available"


回答1:


Finally it is my mistake on generating keys. With the following command lines I can generate all keystores with RSA key algorithm correctly. With these new keystores, the error disappears.

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


来源:https://stackoverflow.com/questions/48561323/error-when-try-to-deploy-a-node-java-lang-illegalargumentexception-unrecognis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!