Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ private EdDSASecurityProviderUtils() {
throw new UnsupportedOperationException("No instance");
}

public static Class<? extends PublicKey> getEDDSAPublicKeyType() {
return EdDSAPublicKey.class;
}

public static Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
return EdDSAPrivateKey.class;
}

public static boolean isEDDSAKey(Key key) {
return getEDDSAKeySize(key) == KEY_SIZE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public int getEDDSAKeySize(Key key) {
}

@Override
public Class<? extends PublicKey> getEDDSAPublicKeyType() {
return EdDSASecurityProviderUtils.getEDDSAPublicKeyType();
public Class<EdDSAPublicKey> getEDDSAPublicKeyType() {
return EdDSAPublicKey.class;
}

@Override
public Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
return EdDSASecurityProviderUtils.getEDDSAPrivateKeyType();
public Class<EdDSAPrivateKey> getEDDSAPrivateKeyType() {
return EdDSAPrivateKey.class;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public int getEDDSAKeySize(Key key) {
}

@Override
public Class<? extends PublicKey> getEDDSAPublicKeyType() {
public Class<EdDSAPublicKey> getEDDSAPublicKeyType() {
return EdDSAPublicKey.class;
}

@Override
public Class<? extends PrivateKey> getEDDSAPrivateKeyType() {
public Class<EdDSAPrivateKey> getEDDSAPrivateKeyType() {
return EdDSAPrivateKey.class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ static PrivateKey decodeEdDSAPrivateKey(byte[] keyData) throws IOException, Gene
/**
* @return the public key class type associated with the security provider.
*/
Class<? extends PublicKey> getEDDSAPublicKeyType();
Class<PUB> getEDDSAPublicKeyType();

/**
* @return the private key class type associated with the security provider.
*/
Class<? extends PrivateKey> getEDDSAPrivateKeyType();
Class<PRV> getEDDSAPrivateKeyType();

/**
* @param k1 the first key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,22 @@
import java.util.Collections;
import java.util.Map;

import net.i2p.crypto.eddsa.EdDSAPrivateKey;
import net.i2p.crypto.eddsa.EdDSAPublicKey;
import org.apache.sshd.common.NamedResource;
import org.apache.sshd.common.keyprovider.KeyPairProvider;
import org.apache.sshd.common.util.security.SecurityUtils;
import org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderUtils;

/**
* TODO Add javadoc
*
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a>
*/
public class EdDSAPuttyKeyDecoder extends AbstractPuttyKeyDecoder<EdDSAPublicKey, EdDSAPrivateKey> {
public class EdDSAPuttyKeyDecoder<PUB extends PublicKey, PRIV extends PrivateKey> extends AbstractPuttyKeyDecoder<PUB, PRIV> {
public static final EdDSAPuttyKeyDecoder INSTANCE = new EdDSAPuttyKeyDecoder();

public EdDSAPuttyKeyDecoder() {
super(EdDSAPublicKey.class, EdDSAPrivateKey.class, Collections.singletonList(KeyPairProvider.SSH_ED25519));
super((Class<PUB>) SecurityUtils.getEdDSASupport().get().getEDDSAPublicKeyType(),
(Class<PRIV>) SecurityUtils.getEdDSASupport().get().getEDDSAPrivateKeyType(),
Collections.singletonList(KeyPairProvider.SSH_ED25519));
}

@Override
Expand All @@ -63,9 +62,9 @@ public Collection<KeyPair> loadKeyPairs(
}

byte[] seed = pubReader.read(Short.MAX_VALUE); // reasonable max. allowed size
PublicKey pubKey = EdDSASecurityProviderUtils.generateEDDSAPublicKey(seed);
PublicKey pubKey = SecurityUtils.getEdDSASupport().get().generateEDDSAPublicKey(seed);
seed = prvReader.read(Short.MAX_VALUE); // reasonable max. allowed size
PrivateKey prvKey = EdDSASecurityProviderUtils.generateEDDSAPrivateKey(seed);
PrivateKey prvKey = SecurityUtils.getEdDSASupport().get().generateEDDSAPrivateKey(seed);
return Collections.singletonList(new KeyPair(pubKey, prvKey));
}
}