Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: net/ntlm/ntlm_test_data.h

Issue 2873673002: Add unit tests for NTLMv1 portable implementation (Closed)
Patch Set: Rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/ntlm/ntlm_constants.h ('k') | net/ntlm/ntlm_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file contains common input and result values use to verify the NTLM
6 // implementation. They are defined in [MS-NLMP] Section 4.2 [1].
7 //
8 // [1] https://msdn.microsoft.com/en-us/library/cc236621.aspx
9
10 #ifndef NET_BASE_NTLM_TEST_DATA_H_
11 #define NET_BASE_NTLM_TEST_DATA_H_
12
13 #include "net/ntlm/ntlm_constants.h"
14
15 namespace net {
16 namespace ntlm {
17 namespace test {
18
19 // Common input values defined in [MS-NLMP] Section 4.2.1.
20 constexpr base::char16 kPassword[] = {'P', 'a', 's', 's', 'w',
21 'o', 'r', 'd', '\0'};
22 constexpr base::char16 kNtlmDomain[] = {'D', 'o', 'm', 'a', 'i', 'n', '\0'};
23 constexpr base::char16 kUser[] = {'U', 's', 'e', 'r', '\0'};
24 constexpr base::char16 kHostname[] = {'C', 'O', 'M', 'P', 'U',
25 'T', 'E', 'R', '\0'};
26
27 // ASCII Versions of the above strings.
28 constexpr char kNtlmDomainAscii[] = "Domain";
29 constexpr char kUserAscii[] = "User";
30 constexpr char kHostnameAscii[] = "COMPUTER";
31
32 // Challenge vectors defined in [MS-NLMP] Section 4.2.1.
33 constexpr uint8_t kServerChallenge[kChallengeLen] = {0x01, 0x23, 0x45, 0x67,
34 0x89, 0xab, 0xcd, 0xef};
35 constexpr uint8_t kClientChallenge[kChallengeLen] = {0xaa, 0xaa, 0xaa, 0xaa,
36 0xaa, 0xaa, 0xaa, 0xaa};
37
38 // A minimal challenge message for tests. For NTLMv1 this implementation only
39 // reads the smallest required version of the message (32 bytes). Some
40 // servers may still send messages this small. The only relevant flags
41 // that affect behavior are that both NTLMSSP_NEGOTIATE_UNICODE and
42 // NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY are set.
43 //
44 // [0-7] - "NTLMSSP\0" (Signature)
45 // [9-11] - |MessageType::kChallenge| (Message Type = 0x00000002)
46 // [12-19] - |SecBuf(kNegotiateMessageLen, 0)|(Target Name - Not Used)
47 // [20-23] - |NEGOTIATE_MESSAGE_FLAGS| (Flags = 0x00088207)
48 // [24-31] - |SERVER_CHALLENGE| (Server Challenge)
49 //
50 // See [MS-NLMP] Section 2.2.2.2 for more information about the Challenge
51 // message.
52 constexpr uint8_t kMinChallengeMessage[kChallengeHeaderLen] = {
53 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0', 0x02, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0x82,
55 0x08, 0x00, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};
56
57 // Test result value for NTOWFv1() defined in [MS-NLMP] Section 4.2.2.1.2.
58 constexpr uint8_t kExpectedNtlmHashV1[kNtlmHashLen] = {
59 0xa4, 0xf4, 0x9c, 0x40, 0x65, 0x10, 0xbd, 0xca,
60 0xb6, 0x82, 0x4e, 0xe7, 0xc3, 0x0f, 0xd8, 0x52};
61
62 // Test result value defined in [MS-NLMP] Section 4.2.2.1.
63 constexpr uint8_t kExpectedNtlmResponseV1[kResponseLenV1] = {
64 0x67, 0xc4, 0x30, 0x11, 0xf3, 0x02, 0x98, 0xa2, 0xad, 0x35, 0xec, 0xe6,
65 0x4f, 0x16, 0x33, 0x1c, 0x44, 0xbd, 0xbe, 0xd9, 0x27, 0x84, 0x1f, 0x94};
66
67 // Test result value defined in [MS-NLMP] Section 4.2.3.2.2.
68 constexpr uint8_t kExpectedNtlmResponseWithV1SS[kResponseLenV1] = {
69 0x75, 0x37, 0xf8, 0x03, 0xae, 0x36, 0x71, 0x28, 0xca, 0x45, 0x82, 0x04,
70 0xbd, 0xe7, 0xca, 0xf8, 0x1e, 0x97, 0xed, 0x26, 0x83, 0x26, 0x72, 0x32};
71
72 // Test result value defined in [MS-NLMP] Section 4.2.3.2.1.
73 constexpr uint8_t kExpectedLmResponseWithV1SS[kResponseLenV1] = {
74 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
76
77 } // namespace test
78 } // namespace ntlm
79 } // namespace net
80
81 #endif // NET_BASE_NTLM_TEST_DATA_H_
OLDNEW
« no previous file with comments | « net/ntlm/ntlm_constants.h ('k') | net/ntlm/ntlm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698