Search in sources :

Example 1 with SPHINCSPlusKeyGenerationParameters

use of org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusKeyGenerationParameters in project jmulticard by ctt-gob-es.

the class SPHINCSPlusKeyPairGeneratorSpi method initialize.

public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
    if (!(params instanceof SPHINCSPlusParameterSpec)) {
        throw new InvalidAlgorithmParameterException("parameter object not a CMCEParameterSpec");
    }
    param = new SPHINCSPlusKeyGenerationParameters(random, (SPHINCSPlusParameters) parameters.get(getNameFromParams(params)));
    engine.init(param);
    initialised = true;
}
Also used : SPHINCSPlusParameterSpec(org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) SPHINCSPlusKeyGenerationParameters(org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusKeyGenerationParameters) SPHINCSPlusParameters(org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusParameters)

Example 2 with SPHINCSPlusKeyGenerationParameters

use of org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusKeyGenerationParameters in project jmulticard by ctt-gob-es.

the class SPHINCSPlusKeyPairGeneratorSpi method generateKeyPair.

public KeyPair generateKeyPair() {
    if (!initialised) {
        param = new SPHINCSPlusKeyGenerationParameters(random, SPHINCSPlusParameters.sha256_256s);
        engine.init(param);
        initialised = true;
    }
    AsymmetricCipherKeyPair pair = engine.generateKeyPair();
    SPHINCSPlusPublicKeyParameters pub = (SPHINCSPlusPublicKeyParameters) pair.getPublic();
    SPHINCSPlusPrivateKeyParameters priv = (SPHINCSPlusPrivateKeyParameters) pair.getPrivate();
    return new KeyPair(new BCSPHINCSPlusPublicKey(pub), new BCSPHINCSPlusPrivateKey(priv));
}
Also used : KeyPair(java.security.KeyPair) AsymmetricCipherKeyPair(org.bouncycastle.crypto.AsymmetricCipherKeyPair) SPHINCSPlusKeyGenerationParameters(org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusKeyGenerationParameters) SPHINCSPlusPublicKeyParameters(org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusPublicKeyParameters) SPHINCSPlusPrivateKeyParameters(org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusPrivateKeyParameters) AsymmetricCipherKeyPair(org.bouncycastle.crypto.AsymmetricCipherKeyPair)

Aggregations

SPHINCSPlusKeyGenerationParameters (org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusKeyGenerationParameters)2 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 KeyPair (java.security.KeyPair)1 AsymmetricCipherKeyPair (org.bouncycastle.crypto.AsymmetricCipherKeyPair)1 SPHINCSPlusParameters (org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusParameters)1 SPHINCSPlusPrivateKeyParameters (org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusPrivateKeyParameters)1 SPHINCSPlusPublicKeyParameters (org.bouncycastle.pqc.crypto.sphincsplus.SPHINCSPlusPublicKeyParameters)1 SPHINCSPlusParameterSpec (org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec)1