Example usage for org.bouncycastle.jcajce.provider.asymmetric.ec BCECPrivateKey BCECPrivateKey

List of usage examples for org.bouncycastle.jcajce.provider.asymmetric.ec BCECPrivateKey BCECPrivateKey

Introduction

In this page you can find the example usage for org.bouncycastle.jcajce.provider.asymmetric.ec BCECPrivateKey BCECPrivateKey.

Prototype

public BCECPrivateKey(String algorithm, BCECPrivateKey key) 

Source Link

Usage

From source file:com.completetrsst.crypto.Crypto.java

License:Apache License

public static byte[] decryptKeyWithIES(byte[] input, PrivateKey privateKey) throws GeneralSecurityException {
    try {/*w  ww. ja  v a2s  . c o m*/
        // BC appears to be happier with BCECPrivateKeys:
        privateKey = new BCECPrivateKey((ECPrivateKey) privateKey, null);

        return _cryptIES(input, privateKey, false);
    } catch (GeneralSecurityException e) {
        log.debug("Error while decrypting key");
        throw new GeneralSecurityException(e);
    }
}

From source file:com.trsst.Crypto.java

License:Apache License

public static byte[] decryptKeyWithIES(byte[] input, long entryId, PublicKey publicKey, PrivateKey privateKey)
        throws GeneralSecurityException {
    try {/*  www .j  a va  2s.  c o m*/
        // BC appears to be happier with BCECPrivateKeys:
        privateKey = new BCECPrivateKey((ECPrivateKey) privateKey, null);

        return _cryptIES(input, privateKey, false);
    } catch (GeneralSecurityException e) {
        log.error("Error while decrypting key", e);
        throw new GeneralSecurityException(e);
    }
}