-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #639 from ianjoneill/f-ed25519-bc
Bouncy Castle EdDSA / Ed25519 Support
- Loading branch information
Showing
24 changed files
with
1,362 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,8 @@ mlkem1024nistp384-sha384. | |
### Signatures/Keys | ||
|
||
* ssh-dss, ssh-rsa, rsa-sha2-256, rsa-sha2-512, nistp256, nistp384, nistp521 | ||
, ssh-ed25519 (requires `eddsa` optional module), [email protected], sk-ssh-ed25519@<!-- -->openssh.com | ||
, ssh-ed25519 (requires Bouncy Castle or `net.i2p.crypto.eddsa` as an optional dependency - if both are present, `net.i2p.crypto.eddsa` is used) | ||
, [email protected], sk-ssh-ed25519@<!-- -->openssh.com | ||
, ssh-rsa-cert-v01@<!-- -->openssh.com, ssh-dss-cert-v01<!-- -->@openssh.com, ssh-ed25519-cert-v01@<!-- -->openssh.com | ||
, ecdsa-sha2-nistp256-cert-v01@<!-- -->openssh.com, ecdsa-sha2-nistp384-cert-v01<!-- -->@openssh.com | ||
, ecdsa-sha2-nistp521-cert-v01<!-- -->@openssh.com | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
import org.apache.sshd.common.util.io.der.DERParser; | ||
import org.apache.sshd.common.util.security.Decryptor; | ||
import org.apache.sshd.common.util.security.SecurityUtils; | ||
import org.apache.sshd.common.util.security.eddsa.Ed25519PEMResourceKeyParser; | ||
import org.apache.sshd.common.util.security.eddsa.generic.EdDSASupport; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> | ||
|
@@ -147,9 +147,9 @@ public Collection<KeyPair> extractKeyPairs(byte[] encBytes, PKCS8PrivateKeyInfo | |
kp = ECDSAPEMResourceKeyPairParser.parseECKeyPair(curve, parser); | ||
} | ||
} else if (SecurityUtils.isEDDSACurveSupported() | ||
&& Ed25519PEMResourceKeyParser.ED25519_OID.endsWith(oid)) { | ||
&& EdDSASupport.ED25519_OID.endsWith(oid)) { | ||
ASN1Object privateKeyBytes = pkcs8Info.getPrivateKeyBytes(); | ||
kp = Ed25519PEMResourceKeyParser.decodeEd25519KeyPair(privateKeyBytes.getPureValueBytes()); | ||
kp = EdDSASupport.decodeEd25519KeyPair(privateKeyBytes.getPureValueBytes()); | ||
} else { | ||
PrivateKey prvKey = decodePEMPrivateKeyPKCS8(oidAlgorithm, encBytes); | ||
PublicKey pubKey = ValidateUtils.checkNotNull(KeyUtils.recoverPublicKey(prvKey), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
|
||
import javax.crypto.Cipher; | ||
|
@@ -45,6 +46,7 @@ | |
import org.apache.sshd.common.util.GenericUtils; | ||
import org.apache.sshd.common.util.IgnoringEmptyMap; | ||
import org.apache.sshd.common.util.ValidateUtils; | ||
import org.apache.sshd.common.util.security.eddsa.generic.EdDSASupport; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> | ||
|
@@ -188,6 +190,13 @@ default boolean isCertificateFactorySupported(String type) { | |
return isSecurityEntitySupported(CertificateFactory.class, type); | ||
} | ||
|
||
/** | ||
* @return the EdDSA support implementation associated with the security provider (if applicable) | ||
*/ | ||
default Optional<EdDSASupport<?, ?>> getEdDSASupport() { | ||
return Optional.empty(); | ||
} | ||
|
||
/** | ||
* @param entityType The requested entity type - its simple name serves to build the configuration property name. | ||
* @return Configuration value to use if no specific configuration provided - default=empty | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.