}
JDKGOST3410PublicKey(
SubjectPublicKeyInfo info)
{
GOST3410PublicKeyAlgParameters params = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters());
DEROctetString derY;
try
{
derY = (DEROctetString)info.getPublicKey();
byte[] keyEnc = derY.getOctets();
byte[] keyBytes = new byte[keyEnc.length];
for (int i = 0; i != keyEnc.length; i++)
{
keyBytes[i] = keyEnc[keyEnc.length - 1 - i]; // was little endian
}
this.y = new BigInteger(1, keyBytes);
}
catch (IOException e)
{
throw new IllegalArgumentException("invalid info structure in GOST3410 public key");
}
GOST3410ParamSetParameters p = GOST3410NamedParameters.getByOID(params.getPublicKeyParamSet());
if (params.getEncryptionParamSet() != null)
{
this.gost3410Spec = new GOST3410ParameterSpec(params.getPublicKeyParamSet().getId(), params.getDigestParamSet().getId(), params.getEncryptionParamSet().getId());
}
else
{
this.gost3410Spec = new GOST3410ParameterSpec(params.getPublicKeyParamSet().getId(), params.getDigestParamSet().getId());
}
}