use of rdpclient.ntlmssp.asn1.TSRequest in project cloudstack by apache.
the class ServerNtlmsspPubKeyPlus1 method handleOneTimeData.
@Override
protected void handleOneTimeData(ByteBuffer buf, Link link) {
TSRequest tsRequest = new TSRequest("TSRequest");
tsRequest.readTag(buf);
ByteBuffer encryptedPubKey = tsRequest.pubKeyAuth.value;
if (encryptedPubKey == null || encryptedPubKey.length == 0)
throw new RuntimeException("[" + this + "] ERROR: Unexpected message from RDP server. Expected encrypted server public key but got nothing instead. Data: " + buf);
byte[] decryptedPubKey = ntlmState.ntlm_DecryptMessage(encryptedPubKey.toByteArray());
//* DEBUG */System.out.println("Decrypted pub key:\n" + new ByteBuffer(decryptedPubKey).dump());
// Decrease first byte by 1
decryptedPubKey[0]--;
// Compare returned value with expected value
if (!Arrays.equals(decryptedPubKey, ntlmState.subjectPublicKey))
throw new RuntimeException("[" + this + "] ERROR: Unexpected message from RDP server. Expected encrypted server public key but an unknown response. Encryted key after decryption: " + new ByteBuffer(decryptedPubKey).toPlainHexString());
buf.unref();
// Ignore packet
switchOff();
}
Aggregations