use of com.jn.agileway.ssh.client.transport.hostkey.UnsupportedHostsKeyTypeException in project agileway by fangjinuo.
the class PublicKeyCodecs method decode.
public static PublicKey decode(byte[] key) {
try {
Buffer<?> buffer = new Buffer.PlainBuffer(key);
final String keyType = extractKeyType(buffer);
if (keyType == null) {
throw new IllegalSshKeyException();
}
PublicKeyCodec codec = PublicKeyCodecRegistry.getInstance().get(keyType);
if (codec == null) {
throw new UnsupportedHostsKeyTypeException(keyType);
}
return codec.decode(buffer.remainingRawBytes());
} catch (Buffer.BufferException e) {
throw new IllegalSshKeyException(e);
}
}
Aggregations