OATH Ejemplo de asociación, disociación y autenticación TOTP para usuarios HSM.
package doxy.examples;
import com.dinamonetworks.Dinamo;
import br.com.trueaccess.TacException;
public class User2FAuthTOTP {
static String ipHSM = "127.0.0.1";
static String usr_admin = "master";
static String password_admin = "12345678";
static String userName = "teste";
public static void main(String[] args) throws TacException {
Dinamo api = new Dinamo();
api.openSession(ipHSM, usr_admin, password_admin, false);
byte[] totpSeed = { (byte)0xD5, (byte)0x17, (byte)0xED, (byte)0x40, (byte)0x1D,
(byte)0xF3, (byte)0x03, (byte)0x38, (byte)0x37, (byte)0xE0,
(byte)0x8B, (byte)0x62, (byte)0x55, (byte)0xBE, (byte)0xDB,
(byte)0xF9, (byte)0x52, (byte)0x0E, (byte)0xF8, (byte)0x8E };
api.assignUserOATHTotp(userName, totpSeed);
Dinamo api2 = new Dinamo();
api2.openSession(ipHSM, userName, "12345678", "992271", false);
api2.closeSession();
api.unassignUserOATH(userName);
api.closeSession();
}
}