Search in sources :

Example 1 with GOST3410ParametersGenerator

use of com.github.zhenwei.core.crypto.generators.GOST3410ParametersGenerator in project LinLong-Java by zhenwei1108.

the class AlgorithmParameterGeneratorSpi method engineGenerateParameters.

protected AlgorithmParameters engineGenerateParameters() {
    GOST3410ParametersGenerator pGen = new GOST3410ParametersGenerator();
    if (random != null) {
        pGen.init(strength, 2, random);
    } else {
        pGen.init(strength, 2, CryptoServicesRegistrar.getSecureRandom());
    }
    GOST3410Parameters p = pGen.generateParameters();
    AlgorithmParameters params;
    try {
        params = createParametersInstance("GOST3410");
        params.init(new GOST3410ParameterSpec(new GOST3410PublicKeyParameterSetSpec(p.getP(), p.getQ(), p.getA())));
    } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
    }
    return params;
}
Also used : GOST3410Parameters(com.github.zhenwei.core.crypto.params.GOST3410Parameters) GOST3410ParametersGenerator(com.github.zhenwei.core.crypto.generators.GOST3410ParametersGenerator) GOST3410ParameterSpec(com.github.zhenwei.provider.jce.spec.GOST3410ParameterSpec) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) AlgorithmParameters(java.security.AlgorithmParameters) GOST3410PublicKeyParameterSetSpec(com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec)

Aggregations

GOST3410ParametersGenerator (com.github.zhenwei.core.crypto.generators.GOST3410ParametersGenerator)1 GOST3410Parameters (com.github.zhenwei.core.crypto.params.GOST3410Parameters)1 GOST3410ParameterSpec (com.github.zhenwei.provider.jce.spec.GOST3410ParameterSpec)1 GOST3410PublicKeyParameterSetSpec (com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec)1 AlgorithmParameters (java.security.AlgorithmParameters)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1