use of com.github.zhenwei.provider.jce.spec.GOST3410PrivateKeySpec in project LinLong-Java by zhenwei1108.
the class KeyFactorySpi method engineGetKeySpec.
protected KeySpec engineGetKeySpec(Key key, Class spec) throws InvalidKeySpecException {
if (spec.isAssignableFrom(GOST3410PublicKeySpec.class) && key instanceof GOST3410PublicKey) {
GOST3410PublicKey k = (GOST3410PublicKey) key;
GOST3410PublicKeyParameterSetSpec parameters = k.getParameters().getPublicKeyParameters();
return new GOST3410PublicKeySpec(k.getY(), parameters.getP(), parameters.getQ(), parameters.getA());
} else if (spec.isAssignableFrom(GOST3410PrivateKeySpec.class) && key instanceof GOST3410PrivateKey) {
GOST3410PrivateKey k = (GOST3410PrivateKey) key;
GOST3410PublicKeyParameterSetSpec parameters = k.getParameters().getPublicKeyParameters();
return new GOST3410PrivateKeySpec(k.getX(), parameters.getP(), parameters.getQ(), parameters.getA());
}
return super.engineGetKeySpec(key, spec);
}
Aggregations