Persist a Besu node key in a HSM using the SunPKCS11Provider. Tested with SoftHSMv2.
- PicoCLIOptions
- SecurityModuleSystem
- Register
- Register the plugin
- Start
- Not Used
- Stop
- Not Used
Build the plugin jar
./gradlew build
Install the plugin into $BESU_HOME
mkdir $BESU_HOME/plugins
cp build/libs/*.jar $BESU_HOME/plugins
Run the Besu node
$BESU_HOME/bin/besu --config-file=options.toml --
softhsm2-util --init-token --slot 0 --label besu
keytool -genkeypair -alias besu -keyalg EC -keystore NONE -storetype PKCS11 -providerClass sun.security.pkcs11.SunPKCS11 -providerArg /path/to/pkcs11.cfg -groupname secp256k1 -dname CN=besu
security-module="hsm"
plugin-hsm-key-alias="besu"
plugin-hsm-keystore-password="12345"
plugin-hsm-keystore-config="./softhsm.cfg"
The above can be passed vi the cli using --plugin...
This is very much a demo for others to learn from - use at your own risk...