use of com.trilead.ssh2.packets.TypesReader in project intellij-community by JetBrains.
the class RSASHA1Verify method decodeSSHRSAPublicKey.
public static RSAPublicKey decodeSSHRSAPublicKey(byte[] key) throws IOException {
TypesReader tr = new TypesReader(key);
String key_format = tr.readString();
if (key_format.equals("ssh-rsa") == false)
throw new IllegalArgumentException("This is not a ssh-rsa public key");
BigInteger e = tr.readMPINT();
BigInteger n = tr.readMPINT();
if (tr.remain() != 0)
throw new IOException("Padding in RSA public key!");
return new RSAPublicKey(e, n);
}
Aggregations