Search in sources :

Example 1 with ECKey

use of org.bouncycastle.jce.interfaces.ECKey in project XobotOS by xamarin.

the class Signature method engineInitSign.

protected void engineInitSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException {
    CipherParameters param;
    if (privateKey instanceof ECKey) {
        param = ECUtil.generatePrivateKeyParameter(privateKey);
    } else {
        throw new InvalidKeyException("can't recognise key type in ECDSA based signer");
    }
    digest.reset();
    if (random != null) {
        signer.init(true, new ParametersWithRandom(param, random));
    } else {
        signer.init(true, param);
    }
}
Also used : CipherParameters(org.bouncycastle.crypto.CipherParameters) ParametersWithRandom(org.bouncycastle.crypto.params.ParametersWithRandom) ECKey(org.bouncycastle.jce.interfaces.ECKey) InvalidKeyException(java.security.InvalidKeyException)

Aggregations

InvalidKeyException (java.security.InvalidKeyException)1 CipherParameters (org.bouncycastle.crypto.CipherParameters)1 ParametersWithRandom (org.bouncycastle.crypto.params.ParametersWithRandom)1 ECKey (org.bouncycastle.jce.interfaces.ECKey)1