PublicKey publicKey, PrivateKey privateKey)
throws GeneralSecurityException {
try {
// BC appears to be happier with BCECPublicKeys:
// see BC's IESCipher.engineInit's check for ECPublicKey
publicKey = new BCECPublicKey((ECPublicKey) publicKey, null);
return _cryptIES(input, publicKey, true);
} catch (GeneralSecurityException e) {
log.error("Error while encrypting key", e);
throw e;