-
Notifications
You must be signed in to change notification settings - Fork 834
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
Conversation
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
besu/src/main/java/org/hyperledger/besu/cli/subcommands/PublicKeySubCommand.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Usman Saleem <[email protected]>
besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
...s/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/cli/subcommands/PublicKeySubCommand.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/services/SecurityModuleServiceImpl.java
Outdated
Show resolved
Hide resolved
besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Outdated
Show resolved
Hide resolved
besu/src/test/java/org/hyperledger/besu/cli/PublicKeySubCommandTest.java
Outdated
Show resolved
Hide resolved
crypto/src/main/java/org/hyperledger/besu/crypto/BouncyCastleSecurityModule.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
|
||
private File nodePrivateKeyFile() { | ||
final Optional<File> nodePrivateKeyFile = | ||
isDocker ? Optional.empty() : Optional.ofNullable(standaloneCommands.nodePrivateKeyFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should no be any docker specific behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file is using docker specific behavior using org/hyperledger/besu/cli/BesuCommand.java:2103
private boolean isFullInstantiation() {
return !isDocker;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's garbage code to be deleted. We don't provide the parameter in the docker image since 29c3c14#diff-ebacf6f6ae4ee68078bb16454b23247dL19 so this part of the code is dead since July 2019. It was discussed about removing it but it was not a priority. Now, if it's confusing, it should be a priority IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I have created #785 and will clean it out in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Its a shame the docker code wasn't cleaned out before now - but the removal shouldn't be part of this work.
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
crypto/src/main/java/org/hyperledger/besu/crypto/KeyPairSecurityModule.java
Outdated
Show resolved
Hide resolved
crypto/src/main/java/org/hyperledger/besu/crypto/KeyPairSecurityModule.java
Outdated
Show resolved
Hide resolved
crypto/src/main/java/org/hyperledger/besu/crypto/ECPointUtil.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Conflicts: plugin-api/build.gradle Signed-off-by: Usman Saleem <[email protected]>
|
||
private File nodePrivateKeyFile() { | ||
final Optional<File> nodePrivateKeyFile = | ||
isDocker ? Optional.empty() : Optional.ofNullable(standaloneCommands.nodePrivateKeyFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Its a shame the docker code wasn't cleaned out before now - but the removal shouldn't be part of this work.
crypto/src/main/java/org/hyperledger/besu/crypto/ECPointUtil.java
Outdated
Show resolved
Hide resolved
private final SECP256K1.KeyPair keyPair; | ||
private final PublicKey publicKey; | ||
|
||
public KeyPairSecurityModule(final SECP256K1.KeyPair keyPair) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: given there's crypto operations happening here, do we want to move this to a static creator? which passes in a privkey and a PublicKey?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only require SECP256K1.KeyPair. The PublicKey is the interface (with ECPoint) that is meant to be converted from SECP256K1's PublicKey. The other option would be to initialize public key on the first access via getPublicKey
. I don't feel the need of creator factory method.
/** | ||
* Registers a provider of security modules. | ||
* | ||
* @param name The name to identify the Security Provider Supplier Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param name The name to identify the Security Provider Supplier Function | |
* @param name The name to identify the Security Provider Supplier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc updated.
plugin-api/src/main/java/org/hyperledger/besu/plugin/services/SecurityModuleService.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Usman Saleem <[email protected]>
…rityModuleService Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
Signed-off-by: Usman Saleem <[email protected]>
PR description
Introduce Security Module Plugin API. This allows to switch to a different security module provider to provide cryptographic function that can be used by NodeKey (such as sign, ECDHKeyAgreement etc.). By default register KeyPairSecurityModule otherwise attempt to load Security Module via plugin API.
CLI Options:
--security-module=<name>
. (defaults tolocalfile
)