Search in sources :

Example 1 with NegoItem

use of rdpclient.ntlmssp.asn1.NegoItem in project cloudstack by apache.

the class ClientNtlmsspNegotiate method onStart.

@Override
protected void onStart() {
    super.onStart();
    ByteBuffer negoToken = generateNegotiateMessage();
    // Store message for MIC calculation in AUTH message
    ntlmState.negotiateMessage = negoToken.toByteArray();
    // Length of packet
    ByteBuffer buf = new ByteBuffer(1024, true);
    TSRequest tsRequest = new TSRequest("TSRequest");
    tsRequest.version.value = 2L;
    NegoItem negoItem = new NegoItem("NegoItem");
    negoItem.negoToken.value = negoToken;
    tsRequest.negoTokens.tags = new Tag[] { negoItem };
    tsRequest.writeTag(buf);
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    pushDataToOTOut(buf);
    switchOff();
}
Also used : NegoItem(rdpclient.ntlmssp.asn1.NegoItem) ByteBuffer(streamer.ByteBuffer) TSRequest(rdpclient.ntlmssp.asn1.TSRequest)

Example 2 with NegoItem

use of rdpclient.ntlmssp.asn1.NegoItem in project cloudstack by apache.

the class ClientNtlmsspPubKeyAuth method dump.

@Override
public void dump(ByteBuffer buf) {
    buf.rewindCursor();
    TSRequest request = new TSRequest("TSRequest");
    request.readTag(buf);
    System.out.println("TSRequest version: " + request.version.value);
    System.out.println("TSRequest pubKey: " + request.pubKeyAuth.value.toPlainHexString());
    ByteBuffer negoToken = ((NegoItem) request.negoTokens.tags[0]).negoToken.value;
    System.out.println("TSRequest negotoken: " + negoToken.toPlainHexString());
    dumpNegoToken(negoToken);
    negoToken.unref();
}
Also used : TSRequest(rdpclient.ntlmssp.asn1.TSRequest) ByteBuffer(streamer.ByteBuffer)

Example 3 with NegoItem

use of rdpclient.ntlmssp.asn1.NegoItem in project cloudstack by apache.

the class ClientNtlmsspPubKeyAuth method onStart.

@Override
protected void onStart() {
    super.onStart();
    /*
         * @see
         * http://blogs.msdn.com/b/openspecification/archive/2010/04/20/ntlm-keys
         * -and-sundry-stuff.aspx
         */
    ntlmState.domain = targetDomain;
    ntlmState.user = user;
    ntlmState.password = password;
    ntlmState.workstation = workstation;
    ntlmState.generateServicePrincipalName(serverHostName);
    ntlmState.ntlm_construct_authenticate_target_info();
    ntlmState.ntlm_generate_timestamp();
    ntlmState.ntlm_generate_client_challenge();
    ntlmState.ntlm_compute_lm_v2_response();
    ntlmState.ntlm_compute_ntlm_v2_response();
    ntlmState.ntlm_generate_key_exchange_key();
    ntlmState.ntlm_generate_random_session_key();
    ntlmState.ntlm_generate_exported_session_key();
    ntlmState.ntlm_encrypt_random_session_key();
    ntlmState.ntlm_init_rc4_seal_states();
    ByteBuffer authenticateMessage = generateAuthenticateMessage(ntlmState);
    ByteBuffer messageSignatureAndEncryptedServerPublicKey = generateMessageSignatureAndEncryptedServerPublicKey(ntlmState);
    // Length of packet
    ByteBuffer buf = new ByteBuffer(4096, true);
    TSRequest tsRequest = new TSRequest("TSRequest");
    tsRequest.version.value = 2L;
    NegoItem negoItem = new NegoItem("NegoItem");
    negoItem.negoToken.value = authenticateMessage;
    tsRequest.negoTokens.tags = new Tag[] { negoItem };
    tsRequest.pubKeyAuth.value = messageSignatureAndEncryptedServerPublicKey;
    tsRequest.writeTag(buf);
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    pushDataToOTOut(buf);
    switchOff();
}
Also used : NegoItem(rdpclient.ntlmssp.asn1.NegoItem) ByteBuffer(streamer.ByteBuffer) TSRequest(rdpclient.ntlmssp.asn1.TSRequest)

Example 4 with NegoItem

use of rdpclient.ntlmssp.asn1.NegoItem in project cloudstack by apache.

the class ServerNtlmsspChallenge method handleOneTimeData.

@Override
protected void handleOneTimeData(ByteBuffer buf, Link link) {
    if (buf == null)
        return;
    if (verbose)
        System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
    // Extract server challenge, extract server flags.
    // Parse TSRequest in BER format
    TSRequest request = new TSRequest("TSRequest");
    request.readTag(buf);
    ByteBuffer negoToken = ((NegoItem) request.negoTokens.tags[0]).negoToken.value;
    // Store message for MIC calculation in AUTH message
    ntlmState.challengeMessage = negoToken.toByteArray();
    parseNtlmChallenge(negoToken);
    negoToken.unref();
    buf.unref();
    switchOff();
}
Also used : TSRequest(rdpclient.ntlmssp.asn1.TSRequest) ByteBuffer(streamer.ByteBuffer)

Aggregations

TSRequest (rdpclient.ntlmssp.asn1.TSRequest)4 ByteBuffer (streamer.ByteBuffer)4 NegoItem (rdpclient.ntlmssp.asn1.NegoItem)2