Search in sources :

Example 6 with GOST3410PublicKeyParameterSetSpec

use of com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec in project LinLong-Java by zhenwei1108.

the class KeyPairGeneratorSpi method init.

private void init(GOST3410ParameterSpec gParams, SecureRandom random) {
    GOST3410PublicKeyParameterSetSpec spec = gParams.getPublicKeyParameters();
    param = new GOST3410KeyGenerationParameters(random, new GOST3410Parameters(spec.getP(), spec.getQ(), spec.getA()));
    engine.init(param);
    initialised = true;
    gost3410Params = gParams;
}
Also used : GOST3410Parameters(com.github.zhenwei.core.crypto.params.GOST3410Parameters) GOST3410KeyGenerationParameters(com.github.zhenwei.core.crypto.params.GOST3410KeyGenerationParameters) GOST3410PublicKeyParameterSetSpec(com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec)

Example 7 with GOST3410PublicKeyParameterSetSpec

use of com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec in project LinLong-Java by zhenwei1108.

the class GOST3410Util method generatePrivateKeyParameter.

public static AsymmetricKeyParameter generatePrivateKeyParameter(PrivateKey key) throws InvalidKeyException {
    if (key instanceof GOST3410PrivateKey) {
        GOST3410PrivateKey k = (GOST3410PrivateKey) key;
        GOST3410PublicKeyParameterSetSpec p = k.getParameters().getPublicKeyParameters();
        return new GOST3410PrivateKeyParameters(k.getX(), new GOST3410Parameters(p.getP(), p.getQ(), p.getA()));
    }
    throw new InvalidKeyException("can't identify GOST3410 private key.");
}
Also used : GOST3410Parameters(com.github.zhenwei.core.crypto.params.GOST3410Parameters) GOST3410PrivateKeyParameters(com.github.zhenwei.core.crypto.params.GOST3410PrivateKeyParameters) InvalidKeyException(java.security.InvalidKeyException) GOST3410PrivateKey(com.github.zhenwei.provider.jce.interfaces.GOST3410PrivateKey) GOST3410PublicKeyParameterSetSpec(com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec)

Aggregations

GOST3410PublicKeyParameterSetSpec (com.github.zhenwei.provider.jce.spec.GOST3410PublicKeyParameterSetSpec)7 GOST3410Parameters (com.github.zhenwei.core.crypto.params.GOST3410Parameters)4 GOST3410ParameterSpec (com.github.zhenwei.provider.jce.spec.GOST3410ParameterSpec)3 DEROctetString (com.github.zhenwei.core.asn1.DEROctetString)2 GOST3410PrivateKey (com.github.zhenwei.provider.jce.interfaces.GOST3410PrivateKey)2 GOST3410PublicKey (com.github.zhenwei.provider.jce.interfaces.GOST3410PublicKey)2 InvalidKeyException (java.security.InvalidKeyException)2 ASN1OctetString (com.github.zhenwei.core.asn1.ASN1OctetString)1 GOST3410ParametersGenerator (com.github.zhenwei.core.crypto.generators.GOST3410ParametersGenerator)1 GOST3410KeyGenerationParameters (com.github.zhenwei.core.crypto.params.GOST3410KeyGenerationParameters)1 GOST3410PrivateKeyParameters (com.github.zhenwei.core.crypto.params.GOST3410PrivateKeyParameters)1 GOST3410PublicKeyParameters (com.github.zhenwei.core.crypto.params.GOST3410PublicKeyParameters)1 PKCS12BagAttributeCarrierImpl (com.github.zhenwei.provider.jcajce.provider.asymmetric.util.PKCS12BagAttributeCarrierImpl)1 GOST3410PrivateKeySpec (com.github.zhenwei.provider.jce.spec.GOST3410PrivateKeySpec)1 GOST3410PublicKeySpec (com.github.zhenwei.provider.jce.spec.GOST3410PublicKeySpec)1 AlgorithmParameters (java.security.AlgorithmParameters)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1