Class OpenSSHEd25519PrivateKeyEntryDecoder
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>
org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>
org.apache.sshd.common.config.keys.impl.AbstractPrivateKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>
org.apache.sshd.common.util.security.eddsa.OpenSSHEd25519PrivateKeyEntryDecoder
- All Implemented Interfaces:
IdentityResourceLoader<net.i2p.crypto.eddsa.EdDSAPublicKey,,net.i2p.crypto.eddsa.EdDSAPrivateKey> KeyEntryResolver<net.i2p.crypto.eddsa.EdDSAPublicKey,,net.i2p.crypto.eddsa.EdDSAPrivateKey> KeyTypeNamesSupport,PrivateKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,,net.i2p.crypto.eddsa.EdDSAPrivateKey> PrivateKeyEntryResolver
public class OpenSSHEd25519PrivateKeyEntryDecoder
extends AbstractPrivateKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final OpenSSHEd25519PrivateKeyEntryDecoderprivate static final intprivate static final intprivate static final intFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
MAX_BIGINT_OCTETS_COUNTFields inherited from interface org.apache.sshd.common.config.keys.PrivateKeyEntryResolver
FAILING, IGNORING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.i2p.crypto.eddsa.EdDSAPrivateKeyclonePrivateKey(net.i2p.crypto.eddsa.EdDSAPrivateKey key) net.i2p.crypto.eddsa.EdDSAPublicKeyclonePublicKey(net.i2p.crypto.eddsa.EdDSAPublicKey key) net.i2p.crypto.eddsa.EdDSAPrivateKeydecodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) encodePrivateKey(SecureByteArrayOutputStream s, net.i2p.crypto.eddsa.EdDSAPrivateKey key, net.i2p.crypto.eddsa.EdDSAPublicKey pubKey) booleannet.i2p.crypto.eddsa.EdDSAPublicKeyrecoverPublicKey(net.i2p.crypto.eddsa.EdDSAPrivateKey prvKey) Attempts to recover the public key given the private oneMethods inherited from class org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver
generatePrivateKey, generatePublicKey, toStringMethods inherited from class org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader
getPrivateKeyType, getPublicKeyType, getSupportedKeyTypesMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
getPrivateKeyType, getPublicKeyTypeMethods inherited from interface org.apache.sshd.common.config.keys.KeyEntryResolver
cloneKeyPair, generateKeyPairMethods inherited from interface org.apache.sshd.common.config.keys.KeyTypeNamesSupport
getSupportedKeyTypesMethods inherited from interface org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder
decodePrivateKey, decodePrivateKey, decodePrivateKey, resolve
-
Field Details
-
INSTANCE
-
PK_SIZE
private static final int PK_SIZE- See Also:
-
SK_SIZE
private static final int SK_SIZE- See Also:
-
KEYPAIR_SIZE
private static final int KEYPAIR_SIZE- See Also:
-
-
Constructor Details
-
OpenSSHEd25519PrivateKeyEntryDecoder
public OpenSSHEd25519PrivateKeyEntryDecoder()
-
-
Method Details
-
decodePrivateKey
public net.i2p.crypto.eddsa.EdDSAPrivateKey decodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) throws IOException, GeneralSecurityException - Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).keyType- The reported / encode key typepasswordProvider- TheFilePasswordProviderto use in case the data is encrypted - may benullif no encrypted data is expectedkeyData- The key data bytes stream positioned after the key type decoding and making sure it is one of the supported types- Returns:
- The decoded
PrivateKey - Throws:
IOException- If failed to read from the data streamGeneralSecurityException- If failed to generate the key
-
encodePrivateKey
public String encodePrivateKey(SecureByteArrayOutputStream s, net.i2p.crypto.eddsa.EdDSAPrivateKey key, net.i2p.crypto.eddsa.EdDSAPublicKey pubKey) throws IOException Description copied from interface:PrivateKeyEntryDecoder- Parameters:
s- TheSecureByteArrayOutputStreamto write the data to.key- ThePrivateKey- may not benullpubKey- ThePublicKeybelonging to the private key - must be non-nullifpublic key recoveryis not supported- Returns:
- The key type value - one of the
KeyTypeNamesSupport.getSupportedKeyTypes()ornullif encoding not supported - Throws:
IOException- If failed to generate the encoding
-
isPublicKeyRecoverySupported
public boolean isPublicKeyRecoverySupported() -
recoverPublicKey
public net.i2p.crypto.eddsa.EdDSAPublicKey recoverPublicKey(net.i2p.crypto.eddsa.EdDSAPrivateKey prvKey) throws GeneralSecurityException Description copied from interface:PrivateKeyEntryDecoderAttempts to recover the public key given the private one- Parameters:
prvKey- ThePrivateKey- Returns:
- The recovered
PublicKey-nullif cannot recover it - Throws:
GeneralSecurityException- If failed to generate the public key
-
clonePublicKey
public net.i2p.crypto.eddsa.EdDSAPublicKey clonePublicKey(net.i2p.crypto.eddsa.EdDSAPublicKey key) throws GeneralSecurityException - Parameters:
key- ThePublicKeyto clone - ignored ifnull- Returns:
- The cloned key (or
nullif no original key) - Throws:
GeneralSecurityException- If failed to clone the key
-
clonePrivateKey
public net.i2p.crypto.eddsa.EdDSAPrivateKey clonePrivateKey(net.i2p.crypto.eddsa.EdDSAPrivateKey key) throws GeneralSecurityException - Parameters:
key- ThePrivateKeyto clone - ignored ifnull- Returns:
- The cloned key (or
nullif no original key) - Throws:
GeneralSecurityException- If failed to clone the key
-
getKeyPairGenerator
- Returns:
- A
KeyPairGeneratorsuitable for this decoder - Throws:
GeneralSecurityException- If failed to create the generator
-
getKeyFactoryInstance
- Returns:
- A
KeyFactorysuitable for the specific decoder type - Throws:
GeneralSecurityException- If failed to create one
-