API Java
HSM Dinamo
Cargando...
Buscando...
No se han encontrado entradas
GenKey.java

Ejemplo de generación de una clave simétrica y una clave asimétrica.

Véase la nota sobre ejemplos.
package doxy.examples;
import com.dinamonetworks.Dinamo;
import br.com.trueaccess.TacException;
import br.com.trueaccess.TacNDJavaLib;
public class GenKey {
static String ipHSM = "127.0.0.1";
static String usr_admin = "master";
static String pass_admin = "12345678";
static String keyName1 = "aes_key";
static String keyName2 = "rsa_key";
public static void main(String[] args) throws TacException {
Dinamo api = new Dinamo();
System.out.println("--> Login HSM and create AES and RSA key");
api.openSession(ipHSM, usr_admin, pass_admin);
System.out.println("--> Create AES and RSA key");
api.createKey(keyName1, TacNDJavaLib.ALG_AES_256, TacNDJavaLib.EXPORTABLE_KEY);
api.createKey(keyName2, TacNDJavaLib.ALG_RSA_2048, TacNDJavaLib.NONEXPORTABLE_KEY);
System.out.println("--> Delete AES and RSA key");
api.deleteKey(keyName1);
api.deleteKey(keyName2);
api.closeSession();
System.out.println("The process ended sucessfully");
}
}