View Javadoc

    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one
    3    *  or more contributor license agreements.  See the NOTICE file
    4    *  distributed with this work for additional information
    5    *  regarding copyright ownership.  The ASF licenses this file
    6    *  to you under the Apache License, Version 2.0 (the
    7    *  "License"); you may not use this file except in compliance
    8    *  with the License.  You may obtain a copy of the License at
    9    *
    10   *    http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   *  Unless required by applicable law or agreed to in writing,
    13   *  software distributed under the License is distributed on an
    14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15   *  KIND, either express or implied.  See the License for the
    16   *  specific language governing permissions and limitations
    17   *  under the License.
    18   *
    19   */
    20  package org.apache.mina.proxy.handlers.http.ntlm;
    21
    22  /**
    23   * NTLMConstants.java - All NTLM constants.
    24   *
    25   * @author <a href="http://mina.apache.org">Apache MINA Project</a>
    26   * @since MINA 2.0.0-M3
    27   */
    28  public interface NTLMConstants {
    29      // Signature "NTLMSSP"+{0}
    30      public final static byte[] NTLM_SIGNATURE = new byte[] { 0x4E, 0x54, 0x4C, 0x4D, 0x53, 0x53, 0x50, 0 };
    31
    32      // Version 5.1.2600 a Windows XP version (ex: Build 2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2)
    33      public final static byte[] DEFAULT_OS_VERSION = new byte[] { 0x05, 0x01, 0x28, 0x0A, 0, 0, 0, 0x0F };
    34
    35      /**
    36       * Message types
    37       */
    38
    39      public final static int MESSAGE_TYPE_1 = 1;
    40
    41      public final static int MESSAGE_TYPE_2 = 2;
    42
    43      public final static int MESSAGE_TYPE_3 = 3;
    44
    45      /**
    46       * Message flags
    47       */
    48
    49      // Indicates that Unicode strings are supported for use in security buffer data
    50      public final static int FLAG_NEGOTIATE_UNICODE = 0x00000001;
    51
    52      // Indicates that OEM strings are supported for use in security buffer data
    53      public final static int FLAG_NEGOTIATE_OEM = 0x00000002;
    54
    55      // Requests that the server's authentication realm be included in the Type 2 message
    56      public final static int FLAG_REQUEST_SERVER_AUTH_REALM = 0x00000004;
    57
    58      // Specifies that authenticated communication between the client
    59      // and server should carry a digital signature (message integrity)
    60      public final static int FLAG_NEGOTIATE_SIGN = 0x00000010;
    61
    62      // Specifies that authenticated communication between the client
    63      // and server should be encrypted (message confidentiality)
    64      public final static int FLAG_NEGOTIATE_SEAL = 0x00000020;
    65
    66      // Indicates that datagram authentication is being used
    67      public final static int FLAG_NEGOTIATE_DATAGRAM_STYLE = 0x00000040;
    68
    69      // Indicates that the Lan Manager Session Key should be used for signing and
    70      // sealing authenticated communications
    71      public final static int FLAG_NEGOTIATE_LAN_MANAGER_KEY = 0x00000080;
    72
    73      // Indicates that NTLM authentication is being used
    74      public final static int FLAG_NEGOTIATE_NTLM = 0x00000200;
    75
    76      // Sent by the client in the Type 3 message to indicate that an anonymous context
    77      // has been established. This also affects the response fields
    78      public final static int FLAG_NEGOTIATE_ANONYMOUS = 0x00000800;
    79
    80      // Sent by the client in the Type 1 message to indicate that the name of the domain in which
    81      // the client workstation has membership is included in the message. This is used by the
    82      // server to determine whether the client is eligible for local authentication
    83      public final static int FLAG_NEGOTIATE_DOMAIN_SUPPLIED = 0x00001000;
    84
    85      // Sent by the client in the Type 1 message to indicate that the client workstation's name
    86      // is included in the message. This is used by the server to determine whether the client
    87      // is eligible for local authentication
    88      public final static int FLAG_NEGOTIATE_WORKSTATION_SUPPLIED = 0x00002000;
    89
    90      // Sent by the server to indicate that the server and client are on the same machine.
    91      // Implies that the client may use the established local credentials for authentication
    92      // instead of calculating a response to the challenge
    93      public final static int FLAG_NEGOTIATE_LOCAL_CALL = 0x00004000;
    94
    95      // Indicates that authenticated communication between the client and server should
    96      // be signed with a "dummy" signature
    97      public final static int FLAG_NEGOTIATE_ALWAYS_SIGN = 0x00008000;
    98
    99      // Sent by the server in the Type 2 message to indicate that the target authentication
    100     // realm is a domain
    101     public final static int FLAG_TARGET_TYPE_DOMAIN = 0x00010000;
    102
    103     // Sent by the server in the Type 2 message to indicate that the target authentication
    104     // realm is a server
    105     public final static int FLAG_TARGET_TYPE_SERVER = 0x00020000;
    106
    107     // Sent by the server in the Type 2 message to indicate that the target authentication
    108     // realm is a share. Presumably, this is for share-level authentication. Usage is unclear
    109     public final static int FLAG_TARGET_TYPE_SHARE = 0x00040000;
    110
    111     // Indicates that the NTLM2 signing and sealing scheme should be used for protecting
    112     // authenticated communications. Note that this refers to a particular session security
    113     // scheme, and is not related to the use of NTLMv2 authentication. This flag can, however,
    114     // have an effect on the response calculations
    115     public final static int FLAG_NEGOTIATE_NTLM2 = 0x00080000;
    116
    117     // Sent by the server in the Type 2 message to indicate that it is including a Target
    118     // Information block in the message. The Target Information block is used in the
    119     // calculation of the NTLMv2 response
    120     public final static int FLAG_NEGOTIATE_TARGET_INFO = 0x00800000;
    121
    122     // Indicates that 128-bit encryption is supported
    123     public final static int FLAG_NEGOTIATE_128_BIT_ENCRYPTION = 0x20000000;
    124
    125     // Indicates that the client will provide an encrypted master key in the "Session Key"
    126     // field of the Type 3 message
    127     public final static int FLAG_NEGOTIATE_KEY_EXCHANGE = 0x40000000;
    128
    129     // Indicates that 56-bit encryption is supported
    130     public final static int FLAG_NEGOTIATE_56_BIT_ENCRYPTION = 0x80000000;
    131
    132     // WARN : These flags usage has not been identified
    133     public final static int FLAG_UNIDENTIFIED_1 = 0x00000008;
    134
    135     public final static int FLAG_UNIDENTIFIED_2 = 0x00000100; // Negotiate Netware ??!
    136
    137     public final static int FLAG_UNIDENTIFIED_3 = 0x00000400;
    138
    139     public final static int FLAG_UNIDENTIFIED_4 = 0x00100000; // Request Init Response ??!
    140
    141     public final static int FLAG_UNIDENTIFIED_5 = 0x00200000; // Request Accept Response ??!
    142
    143     public final static int FLAG_UNIDENTIFIED_6 = 0x00400000; // Request Non-NT Session Key ??!
    144
    145     public final static int FLAG_UNIDENTIFIED_7 = 0x01000000;
    146
    147     public final static int FLAG_UNIDENTIFIED_8 = 0x02000000;
    148
    149     public final static int FLAG_UNIDENTIFIED_9 = 0x04000000;
    150
    151     public final static int FLAG_UNIDENTIFIED_10 = 0x08000000;
    152
    153     public final static int FLAG_UNIDENTIFIED_11 = 0x10000000;
    154
    155     // Default minimal flag set
    156     public final static int DEFAULT_FLAGS = FLAG_NEGOTIATE_OEM | FLAG_NEGOTIATE_UNICODE
    157             | FLAG_NEGOTIATE_WORKSTATION_SUPPLIED | FLAG_NEGOTIATE_DOMAIN_SUPPLIED;
    158
    159     /**
    160      * Target Information sub blocks types. It may be that there are other
    161      * as-yet-unidentified sub block types as well.
    162      */
    163
    164     // Sub block terminator
    165     public final static short TARGET_INFORMATION_SUBBLOCK_TERMINATOR_TYPE = 0x0000;
    166
    167     // Server name
    168     public final static short TARGET_INFORMATION_SUBBLOCK_SERVER_TYPE = 0x0100;
    169
    170     // Domain name
    171     public final static short TARGET_INFORMATION_SUBBLOCK_DOMAIN_TYPE = 0x0200;
    172
    173     // Fully-qualified DNS host name (i.e., server.domain.com)
    174     public final static short TARGET_INFORMATION_SUBBLOCK_FQDNS_HOSTNAME_TYPE = 0x0300;
    175
    176     // DNS domain name (i.e., domain.com)
    177     public final static short TARGET_INFORMATION_SUBBLOCK_DNS_DOMAIN_NAME_TYPE = 0x0400;
    178
    179     // Apparently the "parent" DNS domain for servers in sub domains
    180     public final static short TARGET_INFORMATION_SUBBLOCK_PARENT_DNS_DOMAIN_NAME_TYPE = 0x0500;
    181 }