You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Pradyun Kumar (Jira)" <ji...@apache.org> on 2023/03/14 11:48:00 UTC

[jira] [Created] (SSHD-1321) Cannot read ed25519 privatekey created using bouncy castle and eddsa-0.3.0.jar

Pradyun Kumar created SSHD-1321:
-----------------------------------

             Summary: Cannot read ed25519 privatekey created using bouncy castle and eddsa-0.3.0.jar
                 Key: SSHD-1321
                 URL: https://issues.apache.org/jira/browse/SSHD-1321
             Project: MINA SSHD
          Issue Type: Bug
    Affects Versions: 2.9.2
            Reporter: Pradyun Kumar


We are trying to generate keypair using Ed25519 algorithm. We are using eddsa-0.3.0.jar.
We have added the security provider for the same.
Security.addProvider(new net.i2p.crypto.eddsa.EdDSASecurityProvider());

Code snippet for key generation
keypair = KeyUtils.generateKeyPair("ssh-ed25519", 256);

Private key data is in this format:
-----BEGIN PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,9014B6FD7912A84C144379D7E26FE20B

iub1Uwel6zjsazQ5JIZqmCel/1HpxLyI2jcvO8ET9TF5w8ESCVMmlgPc6PAXgjdn
7N1bsn1lS/FOI4wv9nY90g==
-----END PRIVATE KEY-----

We are facing issue during the parsing of the key.
rawData is a string which contains the private key data as shared above.

passwordProvider is initialized below:
FilePasswordProvider passwordProvider = new FilePasswordProvider() {
public String getPassword(SessionContext session, NamedResource file, int index) throws IOException {
return password;
}
};

Below is the code snippet for parsing of the key:

KeyPairResourceLoader bcLoader = SecurityUtils.getBouncycastleKeyPairResourceParser();
Collection kpList = bcLoader.loadKeyPairs(null, null, passwordProvider, rawData);
KeyPair p = GenericUtils.head(kpList);

But loadKeyPairs method is returning an empty list.
h3. Actual behavior

loadKeyPairs is returning an empty list.
h3. Expected behavior.

loadKeyPairs should return the KeyPair list.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org