Example usage for org.bouncycastle.crypto.params DHParameters getM

List of usage examples for org.bouncycastle.crypto.params DHParameters getM

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.params DHParameters getM.

Prototype

public int getM() 

Source Link

Document

Return the minimum length of the private value.

Usage

From source file:org.xwiki.crypto.internal.asymmetric.generator.BcDHKeyParameterGenerator.java

License:Open Source License

@Override
public KeyGenerationParameters generate(KeyParametersGenerationParameters parameters) {
    if (!(parameters instanceof DHKeyParametersGenerationParameters)) {
        throw new IllegalArgumentException(
                "Invalid parameters for DH key parameters generator: " + parameters.getClass().getName());
    }/*from w  w w. j a v  a2 s.com*/

    org.bouncycastle.crypto.params.DHParameters dhParams = getDhParameters(random.get(),
            (DHKeyParametersGenerationParameters) parameters);

    org.bouncycastle.crypto.params.DHValidationParameters dhValidParams = dhParams.getValidationParameters();

    return new DHKeyGenerationParameters(dhParams.getP(), dhParams.getG(), dhParams.getQ(), dhParams.getM() / 8,
            dhParams.getL() / 8, dhParams.getJ(),
            ((dhValidParams != null)
                    ? new DHKeyValidationParameters(dhValidParams.getSeed(), dhValidParams.getCounter())
                    : null));
}