-
Notifications
You must be signed in to change notification settings - Fork 44
Add EdDSA #68
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
base: main
Are you sure you want to change the base?
Add EdDSA #68
Conversation
voidmain
left a comment
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.
A couple of comments and one possible error. Otherwise, looks good.
|
|
||
| // The JCA does not ship with SHAKE256 which will be used to calculate the hash for Ed448. | ||
| // - Expect this to fail unless FIPS has been enabled. | ||
| try { |
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.
Can you replace this with a call to requireShake256?
| KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(curve); | ||
| keyPairGenerator.initialize(new NamedParameterSpec(curve), new SecureRandom() { | ||
| public void nextBytes(byte[] bytes) { | ||
| System.arraycopy(privateKey, 0, bytes, 0, privateKey.length); |
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.
Can this throw an exception if privateKey is longer than bytes?
| key = privateKey; | ||
| } | ||
|
|
||
| key = Objects.requireNonNullElse(privateKey, 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.
Join lines
| case ES256: | ||
| case HS256: | ||
| case RS256: | ||
| leftMostBits = switch (algorithm) { |
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.
Join lines with the variable declaration
| verifier.initVerify(publicKey); | ||
| verifier.update(message); | ||
|
|
||
| if (!(verifier.verify(signature))) { |
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.
Don't need the double parens
Summary
Add support for EdDSA. Note that this will be moving the min. version of java to 17.
Ed25519andEd448Issue