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

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

Introduction

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

Prototype

BCECPublicKey(SubjectPublicKeyInfo info, ProviderConfiguration configuration) 

Source Link

Usage

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

License:Apache License

public static byte[] encryptKeyWithIES(byte[] input, PublicKey publicKey, PrivateKey privateKey)
        throws GeneralSecurityException {
    try {/*w  w w .j av a 2  s .  c o m*/
        // 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.debug("Error while encrypting key");
        throw e;
    }
}

From source file:com.trsst.Crypto.java

License:Apache License

public static byte[] encryptKeyWithIES(byte[] input, long entryId, PublicKey publicKey, PrivateKey privateKey)
        throws GeneralSecurityException {
    try {//from ww  w  .j  a  v  a2s  . c  o m
        // 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;
    }
}