use of org.bouncycastle.jce.provider.JDKDSAPrivateKey in project keystore-explorer by kaikramer.
the class KeyStoreState method isEntryPrivateKeyEqual.
protected boolean isEntryPrivateKeyEqual(KeyStoreState targetState, String alias, Password password) throws GeneralSecurityException {
Key currentKey = keyStore.getKey(alias, password.toCharArray());
Key targetKey = targetState.getKeyStore().getKey(alias, password.toCharArray());
// JDKDSAPrivateKey has no equals method defined
if ((currentKey instanceof JDKDSAPrivateKey) || (targetKey instanceof JDKDSAPrivateKey)) {
DSAPrivateKey currentDsaKey = (DSAPrivateKey) currentKey;
DSAPrivateKey targetDsaKey = (DSAPrivateKey) targetKey;
return currentDsaKey.getX().equals(targetDsaKey.getX()) && currentDsaKey.getParams().getG().equals(targetDsaKey.getParams().getG()) && currentDsaKey.getParams().getP().equals(targetDsaKey.getParams().getP()) && currentDsaKey.getParams().getQ().equals(targetDsaKey.getParams().getQ());
} else {
return currentKey.equals(targetKey);
}
}
Aggregations