All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dyadicsec.provider.EDDSAKeyPairGenerator Maven / Gradle / Ivy

Go to download

This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi

There is a newer version: 42761
Show newest version
package com.dyadicsec.provider;

import java.security.InvalidAlgorithmParameterException;
import java.security.KeyPair;
import java.security.KeyPairGeneratorSpi;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;

public class EDDSAKeyPairGenerator extends KeyPairGeneratorSpi
{
    private KeyParameters keyParams = null;

    @Override
    public void initialize(int keysize, SecureRandom random)
    {

    }

    @Override
    public void initialize(AlgorithmParameterSpec params, SecureRandom random)
    {
        if (params instanceof KeyGenSpec)
        {
            KeyGenSpec keyGenSpec = (KeyGenSpec) params;
            keyParams = keyGenSpec.params;
        }
    }

    @Override
    public KeyPair generateKeyPair()
    {
        EDDSAPublicKey pubKey = new EDDSAPublicKey();
        EDDSAPrivateKey prvKey = null;

        try { prvKey = new EDDSAPrivateKey().initForGenerate(keyParams, pubKey); }
        catch (Throwable e) { return null; }

        return new KeyPair(pubKey, prvKey);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy