Interface KeyEntryResolver<PUB extends PublicKey,PRV extends PrivateKey>
-
- Type Parameters:
PUB
- Type ofPublicKey
PRV
- Type ofPrivateKey
- All Superinterfaces:
IdentityResourceLoader<PUB,PRV>
,KeyTypeNamesSupport
- All Known Subinterfaces:
PrivateKeyEntryDecoder<PUB,PRV>
,PublicKeyEntryDecoder<PUB,PRV>
- All Known Implementing Classes:
AbstractKeyEntryResolver
,AbstractPrivateKeyEntryDecoder
,AbstractPublicKeyEntryDecoder
,DSSPublicKeyEntryDecoder
,ECDSAPublicKeyEntryDecoder
,Ed25519PublicKeyDecoder
,OpenSSHDSSPrivateKeyEntryDecoder
,OpenSSHECDSAPrivateKeyEntryDecoder
,OpenSSHEd25519PrivateKeyEntryDecoder
,OpenSSHRSAPrivateKeyDecoder
,RSAPublicKeyDecoder
public interface KeyEntryResolver<PUB extends PublicKey,PRV extends PrivateKey> extends IdentityResourceLoader<PUB,PRV>
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
MAX_BIGINT_OCTETS_COUNT
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default KeyPair
cloneKeyPair(KeyPair kp)
PRV
clonePrivateKey(PRV key)
PUB
clonePublicKey(PUB key)
static BigInteger
decodeBigInt(InputStream s)
static int
decodeInt(byte[] buf)
static int
decodeInt(byte[] buf, int offset, int available)
static int
decodeInt(InputStream s)
static Map.Entry<String,Integer>
decodeString(byte[] buf, int maxChars)
static Map.Entry<String,Integer>
decodeString(byte[] buf, int offset, int available, int maxChars)
static Map.Entry<String,Integer>
decodeString(byte[] buf, int offset, int available, Charset cs, int maxChars)
Decodes a run-length encoded stringstatic Map.Entry<String,Integer>
decodeString(byte[] buf, Charset cs, int maxChars)
static String
decodeString(InputStream s, int maxChars)
static String
decodeString(InputStream s, String charset, int maxChars)
static String
decodeString(InputStream s, Charset cs, int maxChars)
static int
encodeBigInt(OutputStream s, BigInteger v)
static byte[]
encodeInt(OutputStream s, int v)
static int
encodeString(OutputStream s, String v)
static int
encodeString(OutputStream s, String v, String charset)
static int
encodeString(OutputStream s, String v, Charset cs)
default KeyPair
generateKeyPair(int keySize)
KeyFactory
getKeyFactoryInstance()
KeyPairGenerator
getKeyPairGenerator()
static Map.Entry<byte[],Integer>
readRLEBytes(byte[] buf, int maxAllowed)
static Map.Entry<byte[],Integer>
readRLEBytes(byte[] buf, int offset, int available, int maxAllowed)
Decodes a run-length encoded byte arraystatic byte[]
readRLEBytes(InputStream s, int maxAllowed)
static int
writeRLEBytes(OutputStream s, byte... bytes)
static int
writeRLEBytes(OutputStream s, byte[] bytes, int off, int len)
-
Methods inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
getPrivateKeyType, getPublicKeyType
-
Methods inherited from interface org.apache.sshd.common.config.keys.KeyTypeNamesSupport
getSupportedKeyTypes
-
-
-
-
Method Detail
-
generateKeyPair
default KeyPair generateKeyPair(int keySize) throws GeneralSecurityException
- Parameters:
keySize
- Key size in bits- Returns:
- A
KeyPair
with the specified key size - Throws:
GeneralSecurityException
- if unable to generate the pair
-
cloneKeyPair
default KeyPair cloneKeyPair(KeyPair kp) throws GeneralSecurityException
- Parameters:
kp
- TheKeyPair
to be cloned - ignored ifnull
- Returns:
- A cloned pair (or
null
if no original pair) - Throws:
GeneralSecurityException
- If failed to clone - e.g., provided key pair does not contain keys of the expected type- See Also:
IdentityResourceLoader.getPublicKeyType()
,IdentityResourceLoader.getPrivateKeyType()
-
clonePublicKey
PUB clonePublicKey(PUB key) throws GeneralSecurityException
- Parameters:
key
- ThePublicKey
to clone - ignored ifnull
- Returns:
- The cloned key (or
null
if no original key) - Throws:
GeneralSecurityException
- If failed to clone the key
-
clonePrivateKey
PRV clonePrivateKey(PRV key) throws GeneralSecurityException
- Parameters:
key
- ThePrivateKey
to clone - ignored ifnull
- Returns:
- The cloned key (or
null
if no original key) - Throws:
GeneralSecurityException
- If failed to clone the key
-
getKeyPairGenerator
KeyPairGenerator getKeyPairGenerator() throws GeneralSecurityException
- Returns:
- A
KeyPairGenerator
suitable for this decoder - Throws:
GeneralSecurityException
- If failed to create the generator
-
getKeyFactoryInstance
KeyFactory getKeyFactoryInstance() throws GeneralSecurityException
- Returns:
- A
KeyFactory
suitable for the specific decoder type - Throws:
GeneralSecurityException
- If failed to create one
-
encodeString
static int encodeString(OutputStream s, String v) throws IOException
- Throws:
IOException
-
encodeString
static int encodeString(OutputStream s, String v, String charset) throws IOException
- Throws:
IOException
-
encodeString
static int encodeString(OutputStream s, String v, Charset cs) throws IOException
- Throws:
IOException
-
encodeBigInt
static int encodeBigInt(OutputStream s, BigInteger v) throws IOException
- Throws:
IOException
-
writeRLEBytes
static int writeRLEBytes(OutputStream s, byte... bytes) throws IOException
- Throws:
IOException
-
writeRLEBytes
static int writeRLEBytes(OutputStream s, byte[] bytes, int off, int len) throws IOException
- Throws:
IOException
-
encodeInt
static byte[] encodeInt(OutputStream s, int v) throws IOException
- Throws:
IOException
-
decodeString
static String decodeString(InputStream s, int maxChars) throws IOException
- Throws:
IOException
-
decodeString
static String decodeString(InputStream s, String charset, int maxChars) throws IOException
- Throws:
IOException
-
decodeString
static String decodeString(InputStream s, Charset cs, int maxChars) throws IOException
- Throws:
IOException
-
decodeBigInt
static BigInteger decodeBigInt(InputStream s) throws IOException
- Throws:
IOException
-
readRLEBytes
static byte[] readRLEBytes(InputStream s, int maxAllowed) throws IOException
- Throws:
IOException
-
decodeInt
static int decodeInt(InputStream s) throws IOException
- Throws:
IOException
-
decodeString
static Map.Entry<String,Integer> decodeString(byte[] buf, int offset, int available, int maxChars)
-
decodeString
static Map.Entry<String,Integer> decodeString(byte[] buf, int offset, int available, Charset cs, int maxChars)
Decodes a run-length encoded string- Parameters:
buf
- The buffer with the data bytesoffset
- The offset in the buffer to decode the stringavailable
- The max. available data starting from the offsetcs
- TheCharset
to use to decode the stringmaxChars
- Max. allowed characters in string - if more than that is encoded then anIndexOutOfBoundsException
will be thrown- Returns:
- The decoded string + the offset of the next byte after it
- See Also:
readRLEBytes(byte[], int, int, int)
-
readRLEBytes
static Map.Entry<byte[],Integer> readRLEBytes(byte[] buf, int offset, int available, int maxAllowed)
Decodes a run-length encoded byte array- Parameters:
buf
- The buffer with the data bytesoffset
- The offset in the buffer to decode the arrayavailable
- The max. available data starting from the offsetmaxAllowed
- Max. allowed data in decoded buffer - if more than that is encoded then anIndexOutOfBoundsException
will be thrown- Returns:
- The decoded data buffer + the offset of the next byte after it
-
decodeInt
static int decodeInt(byte[] buf)
-
decodeInt
static int decodeInt(byte[] buf, int offset, int available)
-
-