-
Notifications
You must be signed in to change notification settings - Fork 867
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
Fix SECP256R1AcceptanceTest #2321
Fix SECP256R1AcceptanceTest #2321
Conversation
…y use it when the nodes are started as their own processes Signed-off-by: Daniel Lehrner <daniel@io.builders>
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.
few comments but overall LGTM
throw new IllegalArgumentException("Cannot store generated private key."); | ||
} | ||
} | ||
|
||
public static File getDefaultKeyFile(final Path homeDirectory) { |
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'd also rename this one s/homeDirectory/directory
final File privateKeyDir = file.getParentFile(); | ||
privateKeyDir.mkdirs(); | ||
final Path tempPath = Files.createTempFile(privateKeyDir.toPath(), ".tmp", ""); | ||
Files.write( | ||
tempPath, | ||
keyKair.getPrivateKey().getEncodedBytes().toString().getBytes(StandardCharsets.UTF_8)); | ||
keyPair.getPrivateKey().getEncodedBytes().toString().getBytes(StandardCharsets.UTF_8)); |
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.
good spot!
} | ||
|
||
private KeyPair createKeyPair(final String privateKey) { | ||
return SIGNATURE_ALGORITHM.createKeyPair( |
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.
might be clearer to name this SECP256R1_ SIGNATURE_ALGORITHM
Signed-off-by: Daniel Lehrner <daniel@io.builders>
* don't set SECP256R1 as signature algorithm instance in the tests, only use it when the nodes are started as their own processes Signed-off-by: Daniel Lehrner <daniel@io.builders> * renamed some variables for better readability Signed-off-by: Daniel Lehrner <daniel@io.builders>
* don't set SECP256R1 as signature algorithm instance in the tests, only use it when the nodes are started as their own processes Signed-off-by: Daniel Lehrner <daniel@io.builders> * renamed some variables for better readability Signed-off-by: Daniel Lehrner <daniel@io.builders>
Signed-off-by: Daniel Lehrner daniel@io.builders
PR description
SECP256R1AcceptanceTest needed to set
SECP256R1
as signature algorithm instance. Because this variable is static and is used inBesuNode
to create a key pair it could happen that other tests were using the SECP256R1 signature algorithm by accident becuase of this, depending on the order in which the tests were executed. This caused the acceptance tests to be flaky.This PR introduces the possibility to set a pre-generated key pair in
BesuNodeFactory
. This allows to set a SECP256R1 key pair without changingSignatureAlgorithmFactory.instance
, which avoids that other tests can happen to use SECP256R1 when they expect SECP256K1.Fixed Issue(s)
reintroduces test which was ignored in #2267
Changelog