} else if (PEM.RSA_PRIVATE_KEY.equals(pem.getType())) {
RSAKeyInfo keyInfo = RSAKeyInfo.getRSAKeyInfo(asn);
ByteArrayWriter baw = new ByteArrayWriter();
baw.writeString("ssh-rsa");
baw.writeBigInteger(keyInfo.getPublicExponent());
baw.writeBigInteger(keyInfo.getModulus());
baw.writeBigInteger(keyInfo.getPrivateExponent());
return baw.toByteArray();
} else {
throw new InvalidSshKeyException("Unsupported type: " +