byte[] encryptedBytes = mac.doFinal(); String computedSignature = Base64.encodeBase64String(encryptedBytes); boolean equalSig = ConstantTimeComparator.compareStrings(signature, computedSignature); if (!equalSig) { s_logger.debug("User signature: " + signature + " is not equaled to computed signature: " + computedSignature);
byte[] encryptedBytes = mac.doFinal(); String computedSignature = new String(Base64.encodeBase64(encryptedBytes)); boolean equalSig = ConstantTimeComparator.compareStrings(signature, computedSignature); if (!equalSig) { s_logger.info("User signature: " + signature + " is not equaled to computed signature: " + computedSignature);
private void dumpNegoToken(ByteBuffer buf) { String signature = buf.readVariableString(RdpConstants.CHARSET_8); if (!ConstantTimeComparator.compareStrings(signature, NTLMSSP)) throw new RuntimeException("Unexpected NTLM message singature: \"" + signature + "\". Expected signature: \"" + NTLMSSP + "\". Data: " + buf + "."); // MessageType (CHALLENGE) int messageType = buf.readSignedIntLE(); if (messageType != NtlmConstants.NTLMSSP_AUTH) throw new RuntimeException("Unexpected NTLM message type: " + messageType + ". Expected type: CHALLENGE (" + NtlmConstants.CHALLENGE + "). Data: " + buf + "."); System.out.println("lmChallengeResponseFields: " + ServerNtlmsspChallenge.readBlockByDescription(buf).toPlainHexString()); ByteBuffer ntChallengeResponseBuf = ServerNtlmsspChallenge.readBlockByDescription(buf); System.out.println("NtChallengeResponse: " + ntChallengeResponseBuf.toPlainHexString()); System.out.println("DomainName: " + ServerNtlmsspChallenge.readStringByDescription(buf)); System.out.println("UserName: " + ServerNtlmsspChallenge.readStringByDescription(buf)); System.out.println("Workstation: " + ServerNtlmsspChallenge.readStringByDescription(buf)); System.out.println("EncryptedRandomSessionKey: " + ServerNtlmsspChallenge.readBlockByDescription(buf).toPlainHexString()); System.out.println("NegotiateFlags: " + new NegoFlags(buf.readSignedIntLE())); System.out.println("Version: " + buf.readBytes(8).toPlainHexString()); dumpNtChallengeResponse(ntChallengeResponseBuf); }
final boolean equalSig = ConstantTimeComparator.compareStrings(signature, computedSignature);
result = ConstantTimeComparator.compareStrings(user.getPassword(), encode(password, salt, rounds));
if (!ConstantTimeComparator.compareStrings(signature, NTLMSSP)) throw new RuntimeException("Unexpected NTLM message singature: \"" + signature + "\". Expected signature: \"" + NTLMSSP + "\". Data: " + buf + ".");