User2FAuthTOTP.java

Exemplo de associação, desassociação e autenticação TOTP OATH para usuários do HSM.

Veja Nota sobre os exemplos.
public class User2FAuthTOTP {
static String ipHSM = "10.0.62.16";
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();
}
}