-
Notifications
You must be signed in to change notification settings - Fork 364
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
Bouncy Castle EdDSA / Ed25519 Support #639
Conversation
Thanks a lot for tackling this. What happens if neither BC nor net.i2p are present, and we're running on a Java that does have EdDSA/Ed25519? I'm not suggesting to change this so that it uses the Java implementation, if present. But IIRC the net.i2p "EDDSA" name is also used in Java (besides "Ed25519 and "Ed448"). |
sshd-common/src/main/java/org/apache/sshd/common/util/security/SecurityProviderRegistrar.java
Outdated
Show resolved
Hide resolved
If you're running on e.g. Java 21 without BC or e.g. if you configure mina in client mode to only support connecting with
Due to there being no If you don't specify the signatures when building the mina client, it won't propose |
Hi @tomaswolf - do you have any other comments on the overall approach? If not, I can take a look at adding some tests. |
Not yet. It's on my to-do list, but until now I haven't yet found the time to look at it in detail and to give it a try. I will eventually get to it; I just don't know yet when. I hope to have some time for this on the week-end before Christmas. |
@ianjoneill : I took a closer look. Impressive work; looks very good. You did a great job integrating this into this awfully complex maze of classes dealing with security providers and key handling. If you have some additional tests to add, by all means do so. The PR needs to be rebased onto current master. The documentation about keys would need to be extended to day that
Apart for that, this looks good to go in. I ran the JGit tests with an Apache MINA sshd snapshot including this PR and with the net.i2p registrar disabled, and they all worked. |
65b9050
to
cc10154
Compare
I've rebased, added some tests and updated the docs. |
Great, thanks a lot! |
if (isFipsMode()) { | ||
return false; | ||
return Optional.empty(); |
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 think this is incorrect as before there was only a single EDSA provider which was never FIPS compliant, now there is a FIPS compliant (bouncycastle) one (when using the FIPS variant) so it should be up to the provider to perform the isFipsMode
check and return an empty optional if their EDDSA support is not compliant.
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.
Not sure. I don't see EdDSA listed as an "approved algorithm" in the BC FIPS Security Policy 2.0.0. It's still listed in "Table 6 - Non-Approved Algorithms Not Allowed in the Approved Mode of Operation".
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.
my mistake I am confusing ECDSA and EDDSA again :-(
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.
OK. I still see the point, though. A future BC-FIPS might have EdDSA as "approved algorithm". It is in NIST SP 800-140C Rev. 2 from 2023-07-25, and is listed at SP 800-140C: Approved Security Functions.
And BC currently has BC FIPS 2.1.0 undergoing validation. So we might have to refactor this approach in the near future.
Adds the capability to use Bouncy Castle for EdDSA / Ed25519 support if it's available, so that you don't have to depend on the
net.i2p.crypto
EdDSA library.If the
net.i2p.crypto
EdDSA library is available, that is used in preference to Bouncy Castle - to ensure there is no change for those that are already running with both providers available.I do not believe this introduces any API breaking changes - all the existing static methods and
net.i2p.crypto
specific classes are still in place.Scenarios tested - in all situations on the Mina side
ssh-ed25519
was configured as the only available signature factory and an Ed25519 key was used for authentication:net.i2p.crypto
available, connecting to OpenSSH SFTP servernet.i2p.crypto
and Bouncy Castle available, connecting to OpenSSH SFTP servernet.i2p.crypto
available, connecting with OpenSSH SFTP clientnet.i2p.crypto
and Bouncy Castle available, connecting with OpenSSH SFTP clientThe generic nature of this implementation makes adding native Java 15+ support with multi-release JARs quite straight forward - once a suitable maven setup has been configured.