use of com.github.zhenwei.provider.jcajce.spec.XMSSParameterSpec in project LinLong-Java by zhenwei1108.
the class XMSSKeyPairGeneratorSpi method initialize.
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
if (!(params instanceof XMSSParameterSpec)) {
throw new InvalidAlgorithmParameterException("parameter object not a XMSSParameterSpec");
}
XMSSParameterSpec xmssParams = (XMSSParameterSpec) params;
if (xmssParams.getTreeDigest().equals(XMSSParameterSpec.SHA256)) {
treeDigest = NISTObjectIdentifiers.id_sha256;
param = new XMSSKeyGenerationParameters(new XMSSParameters(xmssParams.getHeight(), new SHA256Digest()), random);
} else if (xmssParams.getTreeDigest().equals(XMSSParameterSpec.SHA512)) {
treeDigest = NISTObjectIdentifiers.id_sha512;
param = new XMSSKeyGenerationParameters(new XMSSParameters(xmssParams.getHeight(), new SHA512Digest()), random);
} else if (xmssParams.getTreeDigest().equals(XMSSParameterSpec.SHAKE128)) {
treeDigest = NISTObjectIdentifiers.id_shake128;
param = new XMSSKeyGenerationParameters(new XMSSParameters(xmssParams.getHeight(), new SHAKEDigest(128)), random);
} else if (xmssParams.getTreeDigest().equals(XMSSParameterSpec.SHAKE256)) {
treeDigest = NISTObjectIdentifiers.id_shake256;
param = new XMSSKeyGenerationParameters(new XMSSParameters(xmssParams.getHeight(), new SHAKEDigest(256)), random);
}
engine.init(param);
initialised = true;
}
Aggregations