Example usage for org.bouncycastle.crypto.params ParametersWithRandom getRandom

List of usage examples for org.bouncycastle.crypto.params ParametersWithRandom getRandom

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.params ParametersWithRandom getRandom.

Prototype

public SecureRandom getRandom() 

Source Link

Usage

From source file:com.joyent.http.signature.crypto.NativeRSABlindedEngine.java

License:Open Source License

/**
 * initialise the RSA engine./*w ww.  j a v  a  2  s .  c  o m*/
 *
 * @param forEncryption true if we are encrypting, false otherwise.
 * @param param the necessary RSA key parameters.
 */
@Override
public void init(final boolean forEncryption, final CipherParameters param) {
    core.init(forEncryption, param);

    if (param instanceof ParametersWithRandom) {
        ParametersWithRandom rParam = (ParametersWithRandom) param;

        key = (RSAKeyParameters) rParam.getParameters();
        random = rParam.getRandom();
    } else {
        key = (RSAKeyParameters) param;
        random = new SecureRandom();
    }
}