Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Module Plugin API #713

Merged
merged 104 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
8dff540
Node Key Security Provider BouncyCastle backed internal plugin
usmansaleem Apr 14, 2020
33482d5
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 14, 2020
bf62f2c
wip
usmansaleem Apr 15, 2020
76f01f1
wip - renaming plugin name
usmansaleem Apr 15, 2020
3db6b44
refactoring package name
usmansaleem Apr 15, 2020
72b4dc9
wip
usmansaleem Apr 15, 2020
3a30a73
wip - refactor package name
usmansaleem Apr 15, 2020
d5392e7
wip
usmansaleem Apr 15, 2020
160d9df
Merge upstream/master
usmansaleem Apr 15, 2020
b934f3a
wip - clean compile
usmansaleem Apr 15, 2020
2505c3d
spotless fix
usmansaleem Apr 15, 2020
afd1124
test compilation fix
usmansaleem Apr 15, 2020
87e063f
spotless fix
usmansaleem Apr 15, 2020
977b3f0
license header
usmansaleem Apr 15, 2020
5c3e76a
spotless fix
usmansaleem Apr 15, 2020
8a69d3a
spotless fix
usmansaleem Apr 15, 2020
4d14a37
mock fix in CommandTestAbstract
usmansaleem Apr 15, 2020
e044e49
supplier memoize
usmansaleem Apr 15, 2020
4b2209a
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 15, 2020
94f2996
supplier memoize moved into BouncyCastleSecurityModule
usmansaleem Apr 15, 2020
295caef
Fixing PublicKeySubCommand and its unit tests
usmansaleem Apr 15, 2020
7bd3790
updating plugin cli option and removing unit test cases
usmansaleem Apr 15, 2020
4f08b33
Register SecurityModuleService in dsl ThreadBesuRunner
usmansaleem Apr 15, 2020
3b18e3e
refactoring threadbesunoderunner
usmansaleem Apr 15, 2020
a2187a3
variable names cleanup
usmansaleem Apr 15, 2020
c133689
cleanup
usmansaleem Apr 15, 2020
f7e796c
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 15, 2020
ee607f8
remove memoize from bcsecuritymodule
usmansaleem Apr 16, 2020
77b604d
remove nodeKey instance variable from BesuCommand
usmansaleem Apr 16, 2020
1196a41
Fixing CommandTestAbstract mocks and PublicKeySubCommandTest
usmansaleem Apr 16, 2020
cb93117
cleaning up security module name constant
usmansaleem Apr 16, 2020
aa6ead8
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 16, 2020
0774c4e
Using extended Functional interface
usmansaleem Apr 16, 2020
a7d0dfe
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 16, 2020
3630ab8
plugin api changes hash
usmansaleem Apr 16, 2020
92412c4
Ditching BouncyCastle from plugin and package name. Moving to localfile
usmansaleem Apr 16, 2020
2db11f7
exception msg
usmansaleem Apr 16, 2020
d3b1cac
unit test for Plugin
usmansaleem Apr 16, 2020
e1aea38
header
usmansaleem Apr 16, 2020
26962c6
final
usmansaleem Apr 16, 2020
bc45536
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 16, 2020
7a8fb1d
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 17, 2020
690618d
using final keyword in nodePrivateKeyFile()
usmansaleem Apr 17, 2020
570271a
Making PublicKey interface;
usmansaleem Apr 17, 2020
de52ac4
Plugin API hash
usmansaleem Apr 17, 2020
0575240
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 17, 2020
8850fe8
tidying up LocalFileSecurityModulePlugin
usmansaleem Apr 17, 2020
cce1bcb
review - converting Signature to interface
usmansaleem Apr 17, 2020
d83e47f
refactoring Signature and PublicKey in data subpackage
usmansaleem Apr 17, 2020
c5f1738
review - refactoring inner class to be top level class. Adding javadoc
usmansaleem Apr 17, 2020
3088be3
refactoring method out of SecurityModuleProvider
usmansaleem Apr 17, 2020
c28cc76
spotless fix
usmansaleem Apr 17, 2020
7341cfc
adding unstable annotation in plugin interfaces
usmansaleem Apr 17, 2020
eaf709f
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 17, 2020
1627081
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 20, 2020
6a27c66
expose buildNodeKey from BesuCommand so that PublicKeySubcommand can …
usmansaleem Apr 20, 2020
7c19a1a
Merge upstream master
usmansaleem Apr 20, 2020
25af953
use functional reference for nodekey in public key subcommand
usmansaleem Apr 20, 2020
2487f0f
unextend SecurityModuleProvider from Functional.
usmansaleem Apr 20, 2020
007b87a
SecurityModuleException
usmansaleem Apr 20, 2020
47ab014
plugin checksum
usmansaleem Apr 20, 2020
a6ae3a9
Use Runnable function reference to initialize besu configuration serv…
usmansaleem Apr 20, 2020
4943186
LocalFileSecurityModulePlugin - Use isDocker directly
usmansaleem Apr 20, 2020
fc0be7f
review - rename variable to nodeKey
usmansaleem Apr 20, 2020
0a9525a
review - javadoc
usmansaleem Apr 20, 2020
e2ff900
fix compilation issues
usmansaleem Apr 20, 2020
c643c23
use orElseGet
usmansaleem Apr 20, 2020
30c52d1
settings.gradle ordering
usmansaleem Apr 20, 2020
bb7bc22
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 20, 2020
1ad1c45
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 20, 2020
a9a42f4
Expose ECPoint from PublicKey interface'
usmansaleem Apr 21, 2020
860a411
ECPoint byte[] to BigInteger conversion padding
usmansaleem Apr 21, 2020
91c90c9
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 21, 2020
2aac744
javadoc
usmansaleem Apr 21, 2020
aa53c23
checksum
usmansaleem Apr 21, 2020
715450d
spotless fix
usmansaleem Apr 21, 2020
79b4f31
plugin checksum and final keyword
usmansaleem Apr 21, 2020
ee26e5c
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 21, 2020
4bad3f5
ECPointUtil unsigned x y
usmansaleem Apr 22, 2020
4897a0a
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 22, 2020
8b6589f
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 22, 2020
3437e7f
merge upstream master
usmansaleem Apr 22, 2020
24cccad
spotless fix
usmansaleem Apr 23, 2020
39deda8
rename method
usmansaleem Apr 23, 2020
c25d921
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 23, 2020
d9fec18
Removing internal plugin and directly instantiating KeyPairSecurityMo…
usmansaleem Apr 23, 2020
afbc588
removing internal plugin from acceptance dsl
usmansaleem Apr 23, 2020
6283c0c
javadoc
usmansaleem Apr 23, 2020
26aebd3
final keywords
usmansaleem Apr 23, 2020
eb6712a
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 23, 2020
317bc51
ECPointUtil toUnsignedByteArray cleanup and unit tests
usmansaleem Apr 24, 2020
6f675cb
cleaning up KeyPairSecurityModule
usmansaleem Apr 24, 2020
5dee1ab
typo
usmansaleem Apr 24, 2020
73df123
review suggestion - exception message in keypairsecuritymodule
usmansaleem Apr 24, 2020
5f83f01
ECPointUtil cleanup - Use BC BigIntegers.asUnsignedByteArray
usmansaleem Apr 24, 2020
3f62973
Merge upstream master
usmansaleem Apr 25, 2020
6a36b4e
review suggestions
usmansaleem Apr 27, 2020
75c5803
review suggestion - Register default SecurityModuleProvider with Secu…
usmansaleem Apr 27, 2020
b18f39b
spotless fix
usmansaleem Apr 27, 2020
b5dba6d
plugin api checksum
usmansaleem Apr 27, 2020
6322e08
Using Supplier<SecurityModule> instead of SecurityModuleSupplier
usmansaleem Apr 27, 2020
3405b17
plugin api checksum
usmansaleem Apr 27, 2020
519370c
--security-module cli option instead of --security-module-provider
usmansaleem Apr 27, 2020
a47c113
Merge remote-tracking branch 'upstream/master' into nodekey_plugin
usmansaleem Apr 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions acceptance-tests/dsl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {
implementation project(':metrics:core')
implementation project(':plugin-api')
implementation project(':plugins:rocksdb')
implementation project(':plugins:securitymodule-bouncycastle')
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
implementation project(':services:kvstore')
implementation project(':testutil')
implementation project(':util')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.hyperledger.besu.controller.BesuController;
import org.hyperledger.besu.controller.BesuControllerBuilder;
import org.hyperledger.besu.controller.GasLimitCalculator;
import org.hyperledger.besu.crypto.KeyPairUtil;
import org.hyperledger.besu.crypto.NodeKey;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
Expand All @@ -37,12 +37,16 @@
import org.hyperledger.besu.plugin.services.BesuConfiguration;
import org.hyperledger.besu.plugin.services.BesuEvents;
import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import org.hyperledger.besu.plugin.services.SecurityModuleService;
import org.hyperledger.besu.plugin.services.StorageService;
import org.hyperledger.besu.plugin.services.securitymodule.SecurityModule;
import org.hyperledger.besu.plugin.services.securitymodule.bouncycastle.BouncyCastleSecurityModulePlugin;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin;
import org.hyperledger.besu.services.BesuConfigurationImpl;
import org.hyperledger.besu.services.BesuEventsImpl;
import org.hyperledger.besu.services.BesuPluginContextImpl;
import org.hyperledger.besu.services.PicoCLIOptionsImpl;
import org.hyperledger.besu.services.SecurityModuleServiceImpl;
import org.hyperledger.besu.services.StorageServiceImpl;

import java.io.File;
Expand Down Expand Up @@ -71,10 +75,12 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
private BesuPluginContextImpl buildPluginContext(
final BesuNode node,
final StorageServiceImpl storageService,
final SecurityModuleServiceImpl securityModuleService,
final BesuConfiguration commonPluginConfiguration) {
final CommandLine commandLine = new CommandLine(CommandSpec.create());
final BesuPluginContextImpl besuPluginContext = new BesuPluginContextImpl();
besuPluginContext.addService(StorageService.class, storageService);
besuPluginContext.addService(SecurityModuleService.class, securityModuleService);
besuPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));

final Path pluginsPath = node.homeDirectory().resolve("plugins");
Expand All @@ -92,6 +98,7 @@ private BesuPluginContextImpl buildPluginContext(

// register built-in plugins
new RocksDBPlugin().register(besuPluginContext);
new BouncyCastleSecurityModulePlugin().register(besuPluginContext);

return besuPluginContext;
}
Expand All @@ -105,12 +112,16 @@ public void startNode(final BesuNode node) {
ThreadContext.put("node", node.getName());

final StorageServiceImpl storageService = new StorageServiceImpl();
final SecurityModuleServiceImpl securityModuleService = new SecurityModuleServiceImpl();
final Path dataDir = node.homeDirectory();
final BesuConfiguration commonPluginConfiguration =
new BesuConfigurationImpl(dataDir, dataDir.resolve(DATABASE_PATH));
final BesuPluginContextImpl besuPluginContext =
besuPluginContextMap.computeIfAbsent(
node, n -> buildPluginContext(node, storageService, commonPluginConfiguration));
node,
n ->
buildPluginContext(
node, storageService, securityModuleService, commonPluginConfiguration));

final ObservableMetricsSystem metricsSystem =
PrometheusMetricsSystem.init(node.getMetricsConfiguration());
Expand All @@ -133,13 +144,20 @@ public void startNode(final BesuNode node) {
.withMetricsSystem(metricsSystem)
.build();

final SecurityModule securityModule =
securityModuleService
.getByName("bouncycastle")
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
.orElseThrow(
() -> new IllegalStateException("BouncyCastle Security Module not available"))
.apply(commonPluginConfiguration);

final BesuController<?> besuController =
builder
.synchronizerConfiguration(new SynchronizerConfiguration.Builder().build())
.dataDirectory(node.homeDirectory())
.miningParameters(node.getMiningParameters())
.privacyParameters(node.getPrivacyParameters())
.nodePrivateKeyFile(KeyPairUtil.getDefaultKeyFile(node.homeDirectory()))
.nodeKey(new NodeKey(securityModule))
.metricsSystem(metricsSystem)
.transactionPoolConfiguration(TransactionPoolConfiguration.builder().build())
.ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig())
Expand Down
1 change: 1 addition & 0 deletions besu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {
implementation project(':nat')
implementation project(':plugin-api')
implementation project(':plugins:rocksdb')
implementation project(':plugins:securitymodule-bouncycastle')
implementation project(':services:kvstore')

implementation 'com.fasterxml.jackson.core:jackson-databind'
Expand Down
67 changes: 45 additions & 22 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.hyperledger.besu.cli.presynctasks.PrivateDatabaseMigrationPreSyncTask;
import org.hyperledger.besu.cli.subcommands.PasswordSubCommand;
import org.hyperledger.besu.cli.subcommands.PublicKeySubCommand;
import org.hyperledger.besu.cli.subcommands.PublicKeySubCommand.KeyLoader;
import org.hyperledger.besu.cli.subcommands.RetestethSubCommand;
import org.hyperledger.besu.cli.subcommands.blocks.BlocksSubCommand;
import org.hyperledger.besu.cli.subcommands.blocks.BlocksSubCommand.JsonBlockImporterFactory;
Expand All @@ -66,7 +65,7 @@
import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
import org.hyperledger.besu.controller.BesuController;
import org.hyperledger.besu.controller.BesuControllerBuilder;
import org.hyperledger.besu.crypto.KeyPairUtil;
import org.hyperledger.besu.crypto.NodeKey;
import org.hyperledger.besu.enclave.EnclaveFactory;
import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
Expand Down Expand Up @@ -108,16 +107,20 @@
import org.hyperledger.besu.plugin.services.BesuEvents;
import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import org.hyperledger.besu.plugin.services.SecurityModuleService;
import org.hyperledger.besu.plugin.services.StorageService;
import org.hyperledger.besu.plugin.services.exception.StorageException;
import org.hyperledger.besu.plugin.services.metrics.MetricCategory;
import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry;
import org.hyperledger.besu.plugin.services.securitymodule.SecurityModule;
import org.hyperledger.besu.plugin.services.securitymodule.bouncycastle.BouncyCastleSecurityModulePlugin;
import org.hyperledger.besu.plugin.services.storage.PrivacyKeyValueStorageFactory;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin;
import org.hyperledger.besu.services.BesuConfigurationImpl;
import org.hyperledger.besu.services.BesuEventsImpl;
import org.hyperledger.besu.services.BesuPluginContextImpl;
import org.hyperledger.besu.services.PicoCLIOptionsImpl;
import org.hyperledger.besu.services.SecurityModuleServiceImpl;
import org.hyperledger.besu.services.StorageServiceImpl;
import org.hyperledger.besu.util.NetworkUtility;
import org.hyperledger.besu.util.PermissioningConfigurationValidator;
Expand Down Expand Up @@ -199,15 +202,12 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private final BesuController.Builder controllerBuilderFactory;
private final BesuPluginContextImpl besuPluginContext;
private final StorageServiceImpl storageService;
private final SecurityModuleServiceImpl securityModuleService;
private final Map<String, String> environment;
private final MetricCategoryRegistryImpl metricCategoryRegistry =
new MetricCategoryRegistryImpl();
private final MetricCategoryConverter metricCategoryConverter = new MetricCategoryConverter();

protected KeyLoader getKeyLoader() {
return KeyPairUtil::loadKeyPair;
}

// Public IP stored to prevent having to research it each time we need it.
private InetAddress autoDiscoveredDefaultIP = null;

Expand Down Expand Up @@ -813,6 +813,13 @@ void setBannedNodeIds(final List<String> values) {
arity = "1")
private String keyValueStorageName = DEFAULT_KEY_VALUE_STORAGE_NAME;

@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@Option(
names = {"--security-module-provider"},
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
description = "Identity for the Security Module provider to be used.",
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
arity = "1")
private String nodeKeySecurityModuleProviderName = DEFAULT_NODEKEY_SECURITY_MODULE_PROVIDER;

@Option(
names = {"--auto-log-bloom-caching-enabled"},
description = "Enable automatic log bloom caching (default: ${DEFAULT-VALUE})",
Expand Down Expand Up @@ -858,6 +865,7 @@ void setBannedNodeIds(final List<String> values) {
private BesuController<?> besuController;
private StandaloneCommand standaloneCommands;
private BesuConfiguration pluginCommonConfiguration;
private NodeKey nodeKey;
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
private final Supplier<ObservableMetricsSystem> metricsSystem =
Suppliers.memoize(() -> PrometheusMetricsSystem.init(metricsConfiguration()));
private Vertx vertx;
Expand All @@ -880,7 +888,8 @@ public BesuCommand(
controllerBuilderFactory,
besuPluginContext,
environment,
new StorageServiceImpl());
new StorageServiceImpl(),
new SecurityModuleServiceImpl());
}

@VisibleForTesting
Expand All @@ -893,7 +902,8 @@ protected BesuCommand(
final BesuController.Builder controllerBuilderFactory,
final BesuPluginContextImpl besuPluginContext,
final Map<String, String> environment,
final StorageServiceImpl storageService) {
final StorageServiceImpl storageService,
final SecurityModuleServiceImpl securityModuleService) {
this.logger = logger;
this.rlpBlockImporter = rlpBlockImporter;
this.rlpBlockExporterFactory = rlpBlockExporterFactory;
Expand All @@ -903,6 +913,7 @@ protected BesuCommand(
this.besuPluginContext = besuPluginContext;
this.environment = environment;
this.storageService = storageService;
this.securityModuleService = securityModuleService;
}

public void parse(
Expand Down Expand Up @@ -949,6 +960,17 @@ private void addConfigurationService() {
}
}

/* NOTE: Must be called after addConfigurationService */
private void addNodeKey() {
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
if (nodeKey == null) {
nodeKey = new NodeKey(nodeKeySecurityModuleProvider(nodeKeySecurityModuleProviderName));
}
}

public Optional<NodeKey> getNodeKey() {
usmansaleem marked this conversation as resolved.
Show resolved Hide resolved
return Optional.ofNullable(nodeKey);
}

@VisibleForTesting
void setBesuConfiguration(final BesuConfiguration pluginCommonConfiguration) {
this.pluginCommonConfiguration = pluginCommonConfiguration;
Expand Down Expand Up @@ -978,8 +1000,7 @@ private BesuCommand addSubCommands(
rlpBlockExporterFactory,
resultHandler.out()));
commandLine.addSubcommand(
PublicKeySubCommand.COMMAND_NAME,
new PublicKeySubCommand(resultHandler.out(), getKeyLoader()));
PublicKeySubCommand.COMMAND_NAME, new PublicKeySubCommand(resultHandler.out()));
commandLine.addSubcommand(
PasswordSubCommand.COMMAND_NAME, new PasswordSubCommand(resultHandler.out()));
commandLine.addSubcommand(RetestethSubCommand.COMMAND_NAME, new RetestethSubCommand());
Expand Down Expand Up @@ -1025,11 +1046,11 @@ private BesuCommand handleUnstableOptions() {

private BesuCommand preparePlugins() {
besuPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));
besuPluginContext.addService(SecurityModuleService.class, securityModuleService);
besuPluginContext.addService(StorageService.class, storageService);
besuPluginContext.addService(MetricCategoryRegistry.class, metricCategoryRegistry);

// register built-in plugins
new RocksDBPlugin().register(besuPluginContext);
registerBuiltInPlugins();

besuPluginContext.registerPlugins(pluginsDir());

Expand All @@ -1040,6 +1061,11 @@ private BesuCommand preparePlugins() {
return this;
}

private void registerBuiltInPlugins() {
new RocksDBPlugin().register(besuPluginContext);
new BouncyCastleSecurityModulePlugin().register(besuPluginContext);
}

private void parse(
final AbstractParseResultHandler<List<Object>> resultHandler,
final BesuExceptionHandler exceptionHandler,
Expand Down Expand Up @@ -1225,6 +1251,7 @@ public BesuController<?> buildController() {

public BesuControllerBuilder<?> getControllerBuilder() {
addConfigurationService();
addNodeKey();
return controllerBuilderFactory
.fromEthNetworkConfig(updateNetworkConfig(getNetwork()), genesisConfigOverrides)
.synchronizerConfiguration(buildSyncConfig())
Expand All @@ -1242,7 +1269,7 @@ public BesuControllerBuilder<?> getControllerBuilder() {
stratumExtranonce,
Optional.empty()))
.transactionPoolConfiguration(buildTransactionPoolConfiguration())
.nodePrivateKeyFile(nodePrivateKeyFile())
.nodeKey(nodeKey)
.metricsSystem(metricsSystem.get())
.privacyParameters(privacyParameters())
.clock(Clock.systemUTC())
Expand Down Expand Up @@ -1937,15 +1964,11 @@ private Path pluginsDir() {
}
}

public File nodePrivateKeyFile() {
File nodePrivateKeyFile = null;
if (isFullInstantiation()) {
nodePrivateKeyFile = standaloneCommands.nodePrivateKeyFile;
}

return nodePrivateKeyFile != null
? nodePrivateKeyFile
: KeyPairUtil.getDefaultKeyFile(dataDir());
private SecurityModule nodeKeySecurityModuleProvider(final String name) {
return securityModuleService
.getByName(name)
.orElseThrow(() -> new RuntimeException("Node Key Security Module not found: " + name))
.apply(pluginCommonConfiguration);
}

private File privacyPublicKeyFile() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public interface DefaultCommandValues {
float DEFAULT_FRACTION_REMOTE_WIRE_CONNECTIONS_ALLOWED =
RlpxConfiguration.DEFAULT_FRACTION_REMOTE_CONNECTIONS_ALLOWED;
String DEFAULT_KEY_VALUE_STORAGE_NAME = "rocksdb";
String DEFAULT_NODEKEY_SECURITY_MODULE_PROVIDER = "bouncycastle";

static Path getDefaultBesuDataPath(final Object command) {
// this property is retrieved from Gradle tasks or Besu running shell script.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ class StandaloneCommand implements DefaultCommandValues {
"Genesis file. Setting this option makes --network option ignored and requires --network-id to be set.")
final File genesisFile = null;

@CommandLine.Option(
names = {"--node-private-key-file"},
paramLabel = MANDATORY_PATH_FORMAT_HELP,
description =
"The node's private key file (default: a file named \"key\" in the Besu data folder)")
final File nodePrivateKeyFile = null;

@CommandLine.Option(
names = {"--rpc-http-authentication-credentials-file"},
paramLabel = MANDATORY_FILE_FORMAT_HELP,
Expand Down
Loading