/** * Initialize software token * * @throws Exception if an error occurs */ @Command(description = "Initialize software token") public void initSoftwareToken() throws Exception { char[] pin = System.console().readPassword("PIN: "); char[] pin2 = System.console().readPassword("retype PIN: "); if (!Arrays.equals(pin, pin2)) { System.out.println("ERROR: PINs do not match"); return; } try { SignerClient.execute(new InitSoftwareToken(pin)); AuditLogger.log(INITIALIZE_THE_SOFTWARE_TOKEN_EVENT, XROAD_USER, null); } catch (Exception e) { AuditLogger.log(INITIALIZE_THE_SOFTWARE_TOKEN_EVENT, XROAD_USER, e.getMessage(), null); throw e; } }