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
,OpenSSHCertificateDecoder
,OpenSSHDSSPrivateKeyEntryDecoder
,OpenSSHECDSAPrivateKeyEntryDecoder
,OpenSSHEd25519PrivateKeyEntryDecoder
,OpenSSHRSAPrivateKeyDecoder
,RSAPublicKeyDecoder
,SkECDSAPublicKeyEntryDecoder
,SkED25519PublicKeyEntryDecoder
public interface KeyEntryResolver<PUB extends PublicKey,PRV extends PrivateKey>
extends IdentityResourceLoader<PUB,PRV>
-
Field Summary
Fields inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
MAX_BIGINT_OCTETS_COUNT
-
Method Summary
Modifier and TypeMethodDescriptiondefault KeyPair
cloneKeyPair
(KeyPair kp) clonePrivateKey
(PRV key) clonePublicKey
(PUB key) static BigInteger
static int
decodeInt
(byte[] buf) static int
decodeInt
(byte[] buf, int offset, int available) static int
decodeString
(byte[] buf, int maxChars) decodeString
(byte[] buf, int offset, int available, int maxChars) decodeString
(byte[] buf, int offset, int available, Charset cs, int maxChars) Decodes a run-length encoded stringdecodeString
(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
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) readRLEBytes
(byte[] buf, int maxAllowed) 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 Details
-
generateKeyPair
- Parameters:
keySize
- Key size in bits- Returns:
- A
KeyPair
with the specified key size - Throws:
GeneralSecurityException
- if unable to generate the pair
-
cloneKeyPair
- 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:
-
clonePublicKey
- 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
- 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
- Returns:
- A
KeyPairGenerator
suitable for this decoder - Throws:
GeneralSecurityException
- If failed to create the generator
-
getKeyFactoryInstance
- Returns:
- A
KeyFactory
suitable for the specific decoder type - Throws:
GeneralSecurityException
- If failed to create one
-
encodeString
- Throws:
IOException
-
encodeString
- Throws:
IOException
-
encodeString
- Throws:
IOException
-
encodeBigInt
- Throws:
IOException
-
writeRLEBytes
- Throws:
IOException
-
writeRLEBytes
- Throws:
IOException
-
encodeInt
- Throws:
IOException
-
decodeString
- Throws:
IOException
-
decodeString
- Throws:
IOException
-
decodeString
- Throws:
IOException
-
decodeBigInt
- Throws:
IOException
-
readRLEBytes
- Throws:
IOException
-
decodeInt
- Throws:
IOException
-
decodeString
-
decodeString
-
decodeString
-
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
-
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)
-