Search in sources :

Example 1 with SPHINCS256KeyGenParameterSpec

use of com.github.zhenwei.provider.jcajce.spec.SPHINCS256KeyGenParameterSpec in project LinLong-Java by zhenwei1108.

the class Sphincs256KeyPairGeneratorSpi method initialize.

public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
    if (!(params instanceof SPHINCS256KeyGenParameterSpec)) {
        throw new InvalidAlgorithmParameterException("parameter object not a SPHINCS256KeyGenParameterSpec");
    }
    SPHINCS256KeyGenParameterSpec sphincsParams = (SPHINCS256KeyGenParameterSpec) params;
    if (sphincsParams.getTreeDigest().equals(SPHINCS256KeyGenParameterSpec.SHA512_256)) {
        treeDigest = NISTObjectIdentifiers.id_sha512_256;
        param = new SPHINCS256KeyGenerationParameters(random, new SHA512tDigest(256));
    } else if (sphincsParams.getTreeDigest().equals(SPHINCS256KeyGenParameterSpec.SHA3_256)) {
        treeDigest = NISTObjectIdentifiers.id_sha3_256;
        param = new SPHINCS256KeyGenerationParameters(random, new SHA3Digest(256));
    }
    engine.init(param);
    initialised = true;
}
Also used : SHA512tDigest(com.github.zhenwei.core.crypto.digests.SHA512tDigest) SHA3Digest(com.github.zhenwei.core.crypto.digests.SHA3Digest) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) SPHINCS256KeyGenParameterSpec(com.github.zhenwei.provider.jcajce.spec.SPHINCS256KeyGenParameterSpec) SPHINCS256KeyGenerationParameters(com.github.zhenwei.core.pqc.crypto.sphincs.SPHINCS256KeyGenerationParameters)

Aggregations

SHA3Digest (com.github.zhenwei.core.crypto.digests.SHA3Digest)1 SHA512tDigest (com.github.zhenwei.core.crypto.digests.SHA512tDigest)1 SPHINCS256KeyGenerationParameters (com.github.zhenwei.core.pqc.crypto.sphincs.SPHINCS256KeyGenerationParameters)1 SPHINCS256KeyGenParameterSpec (com.github.zhenwei.provider.jcajce.spec.SPHINCS256KeyGenParameterSpec)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1