private String buildType3Msg(String challenge) throws GeneralSecurityException, IOException {
    /* First decode the type2 message to get the server nonce */
    /* nonce is located at type2[24] for 8 bytes */

    byte[] type2 = Base64.getDecoder().decode(challenge);
    byte[] nonce = new byte[8];
    new java.util.Random().nextBytes(nonce);
    byte[] msg = client.type3(type2, nonce);
    String result = "NTLM " + Base64.getEncoder().encodeToString(msg);
    return result;
  }
 private String buildType1Msg() {
   byte[] msg = client.type1();
   String result = "NTLM " + Base64.getEncoder().encodeToString(msg);
   return result;
 }