Skip to content

Example client using java + web3j with mutual tls authentication

Notifications You must be signed in to change notification settings

gonzalobellino/nginx-web3j-tlsclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Using NGINX with GETH service JSON-RPC + TLS client auth

This simple project has an example of how you can establish JSON-RPC connection thru a reverse proxy with mutual authentication using Java language and Web3j.

Pre requirements

Dependencies

Build keystore with client cert and client key (the sample project includes sample crypto materials)

  • pack client cert & key to pkcs12 format
openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12   
  • JKS output
keytool -importkeystore -srckeystore client.p12 \
   -srcstoretype PKCS12 \
   -destkeystore client.jks \
   -deststoretype JKS
  • Import self CA into Keystore
keytool -import -keystore client.jks -file ca.crt  -alias clientCA
  • Make a custom TrustStore
keytool -import -file ca.crt -alias rootCA -keystore myTrustore.jks -storetype JKS

** This example use JKS just for compatibility with java 1.8. Use PKCS12 for java 9 or above. ** It's important that the used server certificate be compatible with this rfc https://www.ietf.org/rfc/rfc2818.txt

Running App

mvn exec:java -Dexec.mainClass="web3j.App"

more info...

https://www.ietf.org/rfc/rfc2818.txt https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html https://dzone.com/articles/intro-to-blockchain-with-ethereum-web3j-and-spring

About

Example client using java + web3j with mutual tls authentication

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages