Search in sources :

Example 1 with TSCredentials

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

the class ClientNtlmsspUserCredentials method generateTSCredentials.

private ByteBuffer generateTSCredentials() {
    ByteBuffer buf = new ByteBuffer(4096);
    TSCredentials tsCredentials = new TSCredentials("authInfo");
    // 1 means that credentials field contains a TSPasswordCreds structure
    tsCredentials.credType.value = 1L;
    ByteBuffer tsPasswordCredsBuf = new ByteBuffer(4096, true);
    TSPasswordCreds tsPasswordCreds = new TSPasswordCreds("credentials");
    tsPasswordCreds.domainName.value = new ByteBuffer(ntlmState.domain.getBytes(RdpConstants.CHARSET_16));
    tsPasswordCreds.userName.value = new ByteBuffer(ntlmState.user.getBytes(RdpConstants.CHARSET_16));
    tsPasswordCreds.password.value = new ByteBuffer(ntlmState.password.getBytes(RdpConstants.CHARSET_16));
    tsPasswordCreds.writeTag(tsPasswordCredsBuf);
    tsPasswordCredsBuf.trimAtCursor();
    //* DEBUG */System.out.println("TSPasswordCreds:\n" + tsPasswordCredsBuf.dump());
    tsCredentials.credentials.value = tsPasswordCredsBuf;
    tsCredentials.writeTag(buf);
    tsPasswordCredsBuf.unref();
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    return buf;
}
Also used : TSCredentials(rdpclient.ntlmssp.asn1.TSCredentials) ByteBuffer(streamer.ByteBuffer) TSPasswordCreds(rdpclient.ntlmssp.asn1.TSPasswordCreds)

Aggregations

TSCredentials (rdpclient.ntlmssp.asn1.TSCredentials)1 TSPasswordCreds (rdpclient.ntlmssp.asn1.TSPasswordCreds)1 ByteBuffer (streamer.ByteBuffer)1