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"). |
|
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! |
| public static Optional<EdDSASupport<?, ?>> getEdDSASupport() { | ||
| if (isFipsMode()) { | ||
| return false; | ||
| return Optional.empty(); |
There was a problem hiding this comment.
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.
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.
my mistake I am confusing ECDSA and EDDSA again :-(
There was a problem hiding this comment.
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.
Not needed since apache/mina-sshd#639 Will also remove one security alert due to GHSA-p53j-g8pw-4w5f
Not needed since apache/mina-sshd#639 Will also remove one security alert due to GHSA-p53j-g8pw-4w5f
Not needed since apache/mina-sshd#639 Will also remove one security alert due to GHSA-p53j-g8pw-4w5f
Not needed since apache/mina-sshd#639 Will also remove one security alert due to GHSA-p53j-g8pw-4w5f Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Not needed since apache/mina-sshd#639 Will also remove one security alert due to GHSA-p53j-g8pw-4w5f
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.cryptoEdDSA library.If the
net.i2p.cryptoEdDSA 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.cryptospecific classes are still in place.Scenarios tested - in all situations on the Mina side
ssh-ed25519was configured as the only available signature factory and an Ed25519 key was used for authentication:net.i2p.cryptoavailable, connecting to OpenSSH SFTP servernet.i2p.cryptoand Bouncy Castle available, connecting to OpenSSH SFTP servernet.i2p.cryptoavailable, connecting with OpenSSH SFTP clientnet.i2p.cryptoand 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.