public RSAPublicKey getPublicKey() { return new RSAPublicKey(e, n); } }
public RSAPublicKey getPublicKey() { return new RSAPublicKey(e, n); } }
private final boolean matchKeys(Object key1, Object key2) { if ((key1 instanceof RSAPublicKey) && (key2 instanceof RSAPublicKey)) { RSAPublicKey savedRSAKey = (RSAPublicKey) key1; RSAPublicKey remoteRSAKey = (RSAPublicKey) key2; if (savedRSAKey.getE().equals(remoteRSAKey.getE()) == false) return false; if (savedRSAKey.getN().equals(remoteRSAKey.getN()) == false) return false; return true; } if ((key1 instanceof DSAPublicKey) && (key2 instanceof DSAPublicKey)) { DSAPublicKey savedDSAKey = (DSAPublicKey) key1; DSAPublicKey remoteDSAKey = (DSAPublicKey) key2; if (savedDSAKey.getG().equals(remoteDSAKey.getG()) == false) return false; if (savedDSAKey.getP().equals(remoteDSAKey.getP()) == false) return false; if (savedDSAKey.getQ().equals(remoteDSAKey.getQ()) == false) return false; if (savedDSAKey.getY().equals(remoteDSAKey.getY()) == false) return false; return true; } return false; }
public RSAPublicKey getPublicKey() { return new RSAPublicKey(e, n); }
private final boolean matchKeys(Object key1, Object key2) { if ((key1 instanceof RSAPublicKey) && (key2 instanceof RSAPublicKey)) { RSAPublicKey savedRSAKey = (RSAPublicKey) key1; RSAPublicKey remoteRSAKey = (RSAPublicKey) key2; if (savedRSAKey.getE().equals(remoteRSAKey.getE()) == false) return false; if (savedRSAKey.getN().equals(remoteRSAKey.getN()) == false) return false; return true; } if ((key1 instanceof DSAPublicKey) && (key2 instanceof DSAPublicKey)) { DSAPublicKey savedDSAKey = (DSAPublicKey) key1; DSAPublicKey remoteDSAKey = (DSAPublicKey) key2; if (savedDSAKey.getG().equals(remoteDSAKey.getG()) == false) return false; if (savedDSAKey.getP().equals(remoteDSAKey.getP()) == false) return false; if (savedDSAKey.getQ().equals(remoteDSAKey.getQ()) == false) return false; if (savedDSAKey.getY().equals(remoteDSAKey.getY()) == false) return false; return true; } return false; }
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); }
@Deprecated public static RSAPublicKey decodeSSHRSAPublicKey(byte[] key) throws IOException { final TypesReader tr = new TypesReader(key); final String key_format = tr.readString(); if (!key_format.equals("ssh-rsa")) { throw new IOWarningException("Unsupported key format found '" + key_format + "' while expecting ssh-rsa"); } final BigInteger e = tr.readMPINT(); final BigInteger n = tr.readMPINT(); if (tr.remain() != 0) { throw new IOException("Padding in RSA public key!"); } return new RSAPublicKey(e, n); }
public static RSAPublicKey decodeSSHRSAPublicKey(byte[] key) throws IOException { final TypesReader tr = new TypesReader(key); final String key_format = tr.readString(); if (!key_format.equals("ssh-rsa")) { throw new IOWarningException("Unsupported key format found '" + key_format + "' while expecting ssh-rsa"); } final BigInteger e = tr.readMPINT(); final BigInteger n = tr.readMPINT(); if (tr.remain() != 0) { throw new IOException("Padding in RSA public key!"); } return new RSAPublicKey(e, n); }