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

com.dyadicsec.provider.LIMAKeyPairGenerator 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.KeyPairGeneratorSpi;
import java.security.SecureRandom;
import java.security.KeyPair;
import java.security.InvalidAlgorithmParameterException;
import java.security.spec.AlgorithmParameterSpec;

/**
 * Created by valery.osheter on 21-Mar-17.
 */
public class LIMAKeyPairGenerator extends KeyPairGeneratorSpi
{
    private KeyParameters keyParams = null;

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

    }

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

    @Override
    public KeyPair generateKeyPair()
    {
        LIMAPublicKey pubKey = new LIMAPublicKey();
        LIMAPrivateKey prvKey = null;

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

        return new KeyPair(pubKey, prvKey);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy