Search in sources :

Example 6 with ParametersWithRandom

use of org.gudy.bouncycastle.crypto.params.ParametersWithRandom 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

ParametersWithRandom (org.gudy.bouncycastle.crypto.params.ParametersWithRandom)6 SecureRandom (java.security.SecureRandom)3 AsymmetricKeyParameter (org.gudy.bouncycastle.crypto.params.AsymmetricKeyParameter)2 CipherParameters (org.gudy.bouncycastle.crypto.CipherParameters)1 RSAKeyParameters (org.gudy.bouncycastle.crypto.params.RSAKeyParameters)1 ECKey (org.gudy.bouncycastle.jce.interfaces.ECKey)1