You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate certificate by java code, and I succeed to start orderer and peer, but I failed to create channel for grpcs error. I know there must something wrong with my tls certs. But i don't know the reason. Can you tell me the reason?
at org.hyperledger.fabric.sdk.OrdererClient.sendTransaction(OrdererClient.java:240)
at org.hyperledger.fabric.sdk.Orderer.sendTransaction(Orderer.java:166)
at org.hyperledger.fabric.sdk.Channel.sendUpdateChannel(Channel.java:538)
at org.hyperledger.fabric.sdk.Channel.<init>(Channel.java:249)
at org.hyperledger.fabric.sdk.Channel.createNewInstance(Channel.java:342)
at org.hyperledger.fabric.sdk.HFClient.newChannel(HFClient.java:297)
at com.yonyou.iuap.bc.baas.net.manager.service.impl.ConfigGenerateServiceImpl.notifyCreateChannel(ConfigGenerateServiceImpl.java:237)
... 125 common frames omitted
at io.grpc.Status.asRuntimeException(Status.java:535)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:479)
at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:463)
at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:427)
at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:460)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 common frames omitted
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException(ReferenceCountedOpenSslEngine.java:1898)
at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.wrap(ReferenceCountedOpenSslEngine.java:822)
at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:511)
at io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:1039)
at io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:925)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1407)
at io.netty.handler.ssl.SslHandler.unwrapNonAppData(SslHandler.java:1325)
at io.netty.handler.ssl.SslHandler.access$1800(SslHandler.java:168)
at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1716)
at io.netty.handler.ssl.SslHandler$SslTasksRunner.access$2000(SslHandler.java:1607)
at io.netty.handler.ssl.SslHandler$SslTasksRunner$2.run(SslHandler.java:1768)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:369)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:275)
at sun.security.validator.Validator.validate(Validator.java:271)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:312)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:275)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:140)
at io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:234)
at io.netty.handler.ssl.ReferenceCountedOpenSslContext$AbstractCertificateVerifier.verify(ReferenceCountedOpenSslContext.java:748)
at io.netty.internal.tcnative.CertificateVerifierTask.runTask(CertificateVerifierTask.java:36)
at io.netty.internal.tcnative.SSLTask.run(SSLTask.java:48)
at io.netty.internal.tcnative.SSLTask.run(SSLTask.java:42)
at io.netty.handler.ssl.ReferenceCountedOpenSslEngine$TaskDecorator.run(ReferenceCountedOpenSslEngine.java:1465)
at io.netty.handler.ssl.SslHandler$SslTasksRunner.run(SslHandler.java:1785)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 common frames omitted`
These client connection errors usually means that the client is not configured with a CA certificate that matches the signer of the server's TLS certificate.
I've opened a PR to add some more TLS troubleshooting information to the Fabric docs that may help you: #3346
It is written from the perspective of a peer CLI client connection, but should be helpful for a Java SDK connection error as well.
What is the corresponding error in the peer log at the time of connection failure?
I'm trying to generate certificate by java code, and I succeed to start orderer and peer, but I failed to create channel for grpcs error. I know there must something wrong with my tls certs. But i don't know the reason. Can you tell me the reason?
`Caused by: org.hyperledger.fabric.sdk.exception.TransactionException: Channel fucking, send transaction failed on orderer OrdererClient{id: 4, channel: fucking, name: fabric-orderer-oynp4ab7, url: grpcs://172.20.52.68:32101}. Reason: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Some Java codes:
`public static BaasCert generateNodeCert(String nodeType, String caType, String nodeName, String orgCode, String orgDomain, String nameSpace, String nodeSubject, Date startDate, Date endDate) throws BusinessException {
Security.addProvider(new BouncyCastleProvider());
try {
KeyPair keyPair = KeyPairUtils.generateFabricKeyPair();
String keyPem = FabricCertService.nodeKeyToPem(keyPair.getPrivate());
public static KeyPair generateFabricKeyPair() { KeyPair keyPair; try { ECGenParameterSpec ecSpec = new ECGenParameterSpec(SECP256R1); KeyPairGenerator kf = KeyPairGenerator.getInstance("EC"); kf.initialize(256, new SecureRandom()); kf.initialize(ecSpec, new SecureRandom()); keyPair = kf.generateKeyPair(); } catch (Exception e) { return null; } return keyPair; }
Below is my certificates, Hope you can tell me the reason.
`
[
[
Version: V3
Subject: C=CN, ST=Beijing, L=Haidian, OU=madong + OU=orderer, CN=fabric-orderer-iwuwcbyf.madong.madong.com
Signature Algorithm: SHA256withECDSA, OID = 1.2.840.10045.4.3.2
Key: Sun EC public key, 256 bits
public x coord: 28785226202240756646177718527367595238983741204018410754881037527273160040806
public y coord: 76967145626319286917147553453023685935363700217575474759376991608531270167364
parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)
Validity: [From: Thu Apr 21 20:26:05 GMT+08:00 2022,
To: Wed Apr 21 20:26:05 GMT+08:00 2027]
Issuer: CN=root.tlsca.xx.com, O=xxcom, L=Haidian, ST=BeiJing, C=CN
SerialNumber: [ 0237977f 68fe997a ce5dbe05 945e7c3e 9aa1e909]
Certificate Extensions: 7
[1]: ObjectId: 1.2.3.4.5.6.7.8.1 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 79 1B 77 7B 22 61 74 74 72 73 22 3A 7B 22 68 .y.w."attrs":."h
0010: 66 2E 41 66 66 69 6C 69 61 74 69 6F 6E 22 3A 22 f.Affiliation":"
0020: 6D 61 64 6F 6E 67 22 2C 22 68 66 2E 45 6E 72 6F madong","hf.Enro
0030: 6C 6C 6D 65 6E 74 49 44 22 3A 22 66 61 62 72 69 llmentID":"fabri
0040: 63 2D 6F 72 64 65 72 65 72 2D 69 77 75 77 63 62 c-orderer-iwuwcb
0050: 79 66 2E 6D 61 64 6F 6E 67 2E 6D 61 64 6F 6E 67 yf.madong.madong
0060: 2E 63 6F 6D 22 2C 22 68 66 2E 54 79 70 65 22 3A .com","hf.Type":
0070: 22 6F 72 64 65 72 65 72 22 7D 7D "orderer"..
[2]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 04 18 30 16 80 14 C0 F1 BB 2E AB 6A 70 7F 99 B1 ..0........jp...
0010: 05 CB A7 61 9C 36 60 03 8C F3 ...a.6`...
]
]
[3]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
CA:false
PathLen: undefined
]
[4]: ObjectId: 2.5.29.37 Criticality=true
ExtendedKeyUsages [
clientAuth
serverAuth
]
[5]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
DigitalSignature
]
[6]: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
DNSName: fabric-orderer-iwuwcbyf
DNSName: fabric-orderer-iwuwcbyf.madong.madong.com
DNSName: fabric-orderer-iwuwcbyf.35568e768fb66d2c8002
]
[7]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: EA 4E 1A 2D 66 A9 4E 57 94 43 98 D5 59 DB 92 70 .N.-f.NW.C..Y..p
0010: 4F 3F C2 53 O?.S
]
]
]
Algorithm: [SHA256withECDSA]
Signature:
0000: 30 44 02 20 42 2B 5D 3D 0C BB B9 94 1B 42 D2 C2 0D. B+]=.....B..
0010: 98 D7 19 BE BE B9 44 58 60 D9 32 E0 B7 80 4C 91 ......DX`.2...L.
0020: BC 64 04 A2 02 20 66 C6 03 BE C6 42 B1 A4 B7 6A .d... f....B...j
0030: 93 BE AB EF 94 BC B7 81 C5 66 14 6D 45 DE B1 FB .........f.mE...
0040: 13 CD 52 FF 18 A1 ..R...
]`
The text was updated successfully, but these errors were encountered: