Search in sources :

Example 1 with AsymmetricKeyParameter

use of org.gudy.bouncycastle.crypto.params.AsymmetricKeyParameter in project BiglyBT by BiglySoftware.

the class PKCS1Encoding method init.

@Override
public void init(boolean forEncryption, CipherParameters param) {
    AsymmetricKeyParameter kParam;
    if (param instanceof ParametersWithRandom) {
        ParametersWithRandom rParam = (ParametersWithRandom) param;
        this.random = rParam.getRandom();
        kParam = (AsymmetricKeyParameter) rParam.getParameters();
    } else {
        this.random = new SecureRandom();
        kParam = (AsymmetricKeyParameter) param;
    }
    engine.init(forEncryption, kParam);
    this.forPrivateKey = kParam.isPrivate();
    this.forEncryption = forEncryption;
}
Also used : AsymmetricKeyParameter(org.gudy.bouncycastle.crypto.params.AsymmetricKeyParameter) ParametersWithRandom(org.gudy.bouncycastle.crypto.params.ParametersWithRandom) SecureRandom(java.security.SecureRandom)

Example 2 with AsymmetricKeyParameter

use of org.gudy.bouncycastle.crypto.params.AsymmetricKeyParameter in project BiglyBT by BiglySoftware.

the class OAEPEncoding method init.

@Override
public void init(boolean forEncryption, CipherParameters param) {
    AsymmetricKeyParameter kParam;
    if (param instanceof ParametersWithRandom) {
        ParametersWithRandom rParam = (ParametersWithRandom) param;
        this.random = rParam.getRandom();
        kParam = (AsymmetricKeyParameter) rParam.getParameters();
    } else {
        this.random = new SecureRandom();
        kParam = (AsymmetricKeyParameter) param;
    }
    engine.init(forEncryption, kParam);
    this.forEncryption = forEncryption;
}
Also used : AsymmetricKeyParameter(org.gudy.bouncycastle.crypto.params.AsymmetricKeyParameter) ParametersWithRandom(org.gudy.bouncycastle.crypto.params.ParametersWithRandom) SecureRandom(java.security.SecureRandom)

Aggregations

SecureRandom (java.security.SecureRandom)2 AsymmetricKeyParameter (org.gudy.bouncycastle.crypto.params.AsymmetricKeyParameter)2 ParametersWithRandom (org.gudy.bouncycastle.crypto.params.ParametersWithRandom)2