Top Fields Methods
org.apache.sshd.common.config.keys

public Interface KeyEntryResolver<PUB extends PublicKey, PRV extends PrivateKey>

extends IdentityResourceLoader<PUB extends PublicKey, PRV extends PrivateKey>
Known Direct Subinterfaces
org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder, org.apache.sshd.common.config.keys.PublicKeyEntryDecoder
Known Direct Implementers
org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver
Type Parameters
<PUB>
Type of PublicKey
<PRV>
Type of PrivateKey
Imports
java.io.IOException, .InputStream, .OutputStream, .StreamCorruptedException, java.math.BigInteger, java.nio.charset.Charset, .StandardCharsets, java.security.GeneralSecurityException, .InvalidKeyException, .KeyFactory, .KeyPair, .KeyPairGenerator, .PrivateKey, .PublicKey, java.util.AbstractMap.SimpleImmutableEntry, .Map, org.apache.sshd.common.util.NumberUtils, org.apache.sshd.common.util.io.IoUtils

Author
Apache MINA SSHD Project

Field Summary

Inherited from org.apache.sshd.common.config.keys.IdentityResourceLoader:
MAX_BIGINT_OCTETS_COUNT

Method Summary

Modifier and TypeMethod and Description
public default KeyPair

Returns:

A cloned pair (or null if no original pair)
cloneKeyPair
(KeyPair
The KeyPair to be cloned - ignored if null
kp
)

public PRV

Returns:

The cloned key (or null if no original key)
clonePrivateKey
(PRV
The PrivateKey to clone - ignored if null
key
)

public PUB

Returns:

The cloned key (or null if no original key)
clonePublicKey
(PUB
The PublicKey to clone - ignored if null
key
)

public static BigInteger
public static int
public static int
decodeInt(byte[] buf)

public static int
decodeInt(byte[] buf, int offset, int available)

public static String
decodeString(InputStream s, int maxChars)

public static String
decodeString(InputStream s, String charset, int maxChars)

public static String
decodeString(InputStream s, Charset cs, int maxChars)

public static Map.Entry<String, Integer>
decodeString(byte[] buf, int maxChars)

public static Map.Entry<String, Integer>
decodeString(byte[] buf, int offset, int available, int maxChars)

public static Map.Entry<String, Integer>
decodeString(byte[] buf, Charset cs, int maxChars)

public static Map.Entry<String, Integer>

Returns:

The decoded string + the offset of the next byte after it
decodeString
(byte[]
The buffer with the data bytes
buf
,
int
The offset in the buffer to decode the string
offset
,
int
The max. available data starting from the offset
available
,
Charset
The Charset to use to decode the string
cs
,
int
Max. allowed characters in string - if more than that is encoded then an IndexOutOfBoundsException will be thrown
maxChars
)

Decodes a run-length encoded string

public static int
public static byte[]
public static int
public static int
public static int
public default KeyPair

Returns:

A KeyPair with the specified key size
generateKeyPair
(int
Key size in bits
keySize
)

public KeyFactory

Returns:

A KeyFactory suitable for the specific decoder type
getKeyFactoryInstance
()

public KeyPairGenerator

Returns:

A KeyPairGenerator suitable for this decoder
getKeyPairGenerator
()

public static byte[]
readRLEBytes(InputStream s, int maxAllowed)

public static Map.Entry<byte[], Integer>
readRLEBytes(byte[] buf, int maxAllowed)

public static Map.Entry<byte[], Integer>

Returns:

The decoded data buffer + the offset of the next byte after it
readRLEBytes
(byte[]
The buffer with the data bytes
buf
,
int
The offset in the buffer to decode the array
offset
,
int
The max. available data starting from the offset
available
,
int
Max. allowed data in decoded buffer - if more than that is encoded then an IndexOutOfBoundsException will be thrown
maxAllowed
)

Decodes a run-length encoded byte array

public static int
writeRLEBytes(OutputStream s, byte... bytes)

public static int
writeRLEBytes(OutputStream s, byte[] bytes, int off, int len)

Inherited from org.apache.sshd.common.config.keys.IdentityResourceLoader:
getPrivateKeyTypegetPublicKeyType

Method Detail

cloneKeyPairback to summary
public default KeyPair cloneKeyPair(KeyPair kp) throws GeneralSecurityException
Parameters
kp:KeyPair

The KeyPair to be cloned - ignored if null

Returns:KeyPair

A cloned pair (or null if no original pair)

Exceptions
GeneralSecurityException:
If failed to clone - e.g., provided key pair does not contain keys of the expected type
See Also
getPublicKeyType(), getPrivateKeyType()
clonePrivateKeyback to summary
public PRV clonePrivateKey(PRV key) throws GeneralSecurityException
Parameters
key:PRV

The PrivateKey to clone - ignored if null

Returns:PRV

The cloned key (or null if no original key)

Exceptions
GeneralSecurityException:
If failed to clone the key
clonePublicKeyback to summary
public PUB clonePublicKey(PUB key) throws GeneralSecurityException
Parameters
key:PUB

The PublicKey to clone - ignored if null

Returns:PUB

The cloned key (or null if no original key)

Exceptions
GeneralSecurityException:
If failed to clone the key
decodeBigIntback to summary
public static BigInteger decodeBigInt(InputStream s) throws IOException
decodeIntback to summary
public static int decodeInt(InputStream s) throws IOException
decodeIntback to summary
public static int decodeInt(byte[] buf)
decodeIntback to summary
public static int decodeInt(byte[] buf, int offset, int available)
decodeStringback to summary
public static String decodeString(InputStream s, int maxChars) throws IOException
decodeStringback to summary
public static String decodeString(InputStream s, String charset, int maxChars) throws IOException
decodeStringback to summary
public static String decodeString(InputStream s, Charset cs, int maxChars) throws IOException
decodeStringback to summary
public static Map.Entry<String, Integer> decodeString(byte[] buf, int maxChars)
decodeStringback to summary
public static Map.Entry<String, Integer> decodeString(byte[] buf, int offset, int available, int maxChars)
decodeStringback to summary
public static Map.Entry<String, Integer> decodeString(byte[] buf, Charset cs, int maxChars)
decodeStringback to summary
public static Map.Entry<String, Integer> decodeString(byte[] buf, int offset, int available, Charset cs, int maxChars)

Decodes a run-length encoded string

Parameters
buf:byte[]

The buffer with the data bytes

offset:int

The offset in the buffer to decode the string

available:int

The max. available data starting from the offset

cs:Charset

The Charset to use to decode the string

maxChars:int

Max. allowed characters in string - if more than that is encoded then an IndexOutOfBoundsException will be thrown

Returns:Map.Entry<String, Integer>

The decoded string + the offset of the next byte after it

See Also
readRLEBytes(byte[], int, int, int)
encodeBigIntback to summary
public static int encodeBigInt(OutputStream s, BigInteger v) throws IOException
encodeIntback to summary
public static byte[] encodeInt(OutputStream s, int v) throws IOException
encodeStringback to summary
public static int encodeString(OutputStream s, String v) throws IOException
encodeStringback to summary
public static int encodeString(OutputStream s, String v, String charset) throws IOException
encodeStringback to summary
public static int encodeString(OutputStream s, String v, Charset cs) throws IOException
generateKeyPairback to summary
public default KeyPair generateKeyPair(int keySize) throws GeneralSecurityException
Parameters
keySize:int

Key size in bits

Returns:KeyPair

A KeyPair with the specified key size

Exceptions
GeneralSecurityException:
if unable to generate the pair
getKeyFactoryInstanceback to summary
public KeyFactory getKeyFactoryInstance() throws GeneralSecurityException
Returns:KeyFactory

A KeyFactory suitable for the specific decoder type

Exceptions
GeneralSecurityException:
If failed to create one
getKeyPairGeneratorback to summary
public KeyPairGenerator getKeyPairGenerator() throws GeneralSecurityException
Returns:KeyPairGenerator

A KeyPairGenerator suitable for this decoder

Exceptions
GeneralSecurityException:
If failed to create the generator
readRLEBytesback to summary
public static byte[] readRLEBytes(InputStream s, int maxAllowed) throws IOException
readRLEBytesback to summary
public static Map.Entry<byte[], Integer> readRLEBytes(byte[] buf, int maxAllowed)
readRLEBytesback to summary
public static Map.Entry<byte[], Integer> readRLEBytes(byte[] buf, int offset, int available, int maxAllowed)

Decodes a run-length encoded byte array

Parameters
buf:byte[]

The buffer with the data bytes

offset:int

The offset in the buffer to decode the array

available:int

The max. available data starting from the offset

maxAllowed:int

Max. allowed data in decoded buffer - if more than that is encoded then an IndexOutOfBoundsException will be thrown

Returns:Map.Entry<byte[], Integer>

The decoded data buffer + the offset of the next byte after it

writeRLEBytesback to summary
public static int writeRLEBytes(OutputStream s, byte... bytes) throws IOException
writeRLEBytesback to summary
public static int writeRLEBytes(OutputStream s, byte[] bytes, int off, int len) throws IOException