Java Code Examples for jcifs.ntlmssp.Type2Message#toByteArray()

The following examples show how to use jcifs.ntlmssp.Type2Message#toByteArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NtlmTest.java    From jcifs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testParsingType2TargetInformation () throws IOException {
    int flags = 0;
    byte[] challenge = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    byte[] ti = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    Type2Message t2 = new Type2Message(this.context, flags, challenge, null);
    t2.setTargetInformation(ti);

    Type2Message parsed = new Type2Message(t2.toByteArray());
    assertArrayEquals(challenge, parsed.getChallenge());
    assertNull(parsed.getTarget());
    assertArrayEquals(ti, parsed.getTargetInformation());
}
 
Example 2
Source File: NtlmTest.java    From jcifs-ng with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testParsingType2TargetInformation () throws IOException {
    int flags = 0;
    byte[] challenge = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    byte[] ti = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    Type2Message t2 = new Type2Message(this.context, flags, challenge, null);
    t2.setTargetInformation(ti);

    Type2Message parsed = new Type2Message(t2.toByteArray());
    assertArrayEquals(challenge, parsed.getChallenge());
    assertNull(parsed.getTarget());
    assertArrayEquals(ti, parsed.getTargetInformation());
}
 
Example 3
Source File: NtlmTest.java    From jcifs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParsingType2Target () throws IOException {
    int flags = NtlmFlags.NTLMSSP_REQUEST_TARGET;
    String target = "TARGET";
    byte[] challenge = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    Type2Message t2 = new Type2Message(this.context, flags, challenge, target);
    Type2Message parsed = new Type2Message(t2.toByteArray());
    assertArrayEquals(challenge, parsed.getChallenge());
    assertEquals(target, parsed.getTarget());
}
 
Example 4
Source File: NtlmTest.java    From jcifs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParsingType2NoTarget () throws IOException {
    int flags = 0;
    byte[] challenge = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    Type2Message t2 = new Type2Message(this.context, flags, challenge, null);
    Type2Message parsed = new Type2Message(t2.toByteArray());
    assertArrayEquals(challenge, parsed.getChallenge());
    assertNull(parsed.getTarget());
    assertNull(parsed.getTargetInformation());
}
 
Example 5
Source File: NtlmTest.java    From jcifs-ng with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParsingType2Target () throws IOException {
    int flags = NtlmFlags.NTLMSSP_REQUEST_TARGET;
    String target = "TARGET";
    byte[] challenge = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    Type2Message t2 = new Type2Message(this.context, flags, challenge, target);
    Type2Message parsed = new Type2Message(t2.toByteArray());
    assertArrayEquals(challenge, parsed.getChallenge());
    assertEquals(target, parsed.getTarget());
}
 
Example 6
Source File: NtlmTest.java    From jcifs-ng with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testParsingType2NoTarget () throws IOException {
    int flags = 0;
    byte[] challenge = new byte[] {
        0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8
    };

    Type2Message t2 = new Type2Message(this.context, flags, challenge, null);
    Type2Message parsed = new Type2Message(t2.toByteArray());
    assertArrayEquals(challenge, parsed.getChallenge());
    assertNull(parsed.getTarget());
    assertNull(parsed.getTargetInformation());
}