Package jcifs.ntlmssp

Examples of jcifs.ntlmssp.Type2Message


            Type1Message type1Message = new Type1Message(Type1Message.getDefaultFlags(), domain, workstation);
            return Base64.encode(type1Message.toByteArray());
        }

        public String generateType3Msg(String username, String password, String domain, String workstation, String challenge) throws NTLMEngineException {
            Type2Message type2Message = decodeType2Message(challenge);
            Type3Message type3Message = new Type3Message(type2Message, password, domain, username, workstation, Type3Message.getDefaultFlags());
            return Base64.encode(type3Message.toByteArray());
        }
View Full Code Here


            return Base64.encode(type3Message.toByteArray());
        }

        private Type2Message decodeType2Message(String challenge) throws NTLMEngineException {
            try {
                return new Type2Message(Base64.decode(challenge));
            } catch (final IOException exception) {
                throw new NTLMEngineException("Invalid Type2 message", exception);
            }
        }
View Full Code Here

        }
        if (authMethod == null) return null;
        NtlmMessage message = null;
        if (authorization != null) {
            try {
                message = new Type2Message(Base64.decode(authorization));
            } catch (IOException ioe) {
                ioe.printStackTrace();
                return null;
            }
        }
        // reconnect();
        int flags = NtlmFlags.NTLMSSP_NEGOTIATE_NTLM2 | NtlmFlags.NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NtlmFlags.NTLMSSP_NEGOTIATE_NTLM | NtlmFlags.NTLMSSP_REQUEST_TARGET | NtlmFlags.NTLMSSP_NEGOTIATE_OEM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE;
        if (message == null) {
            message = new Type1Message(flags, null, null);
        } else {
            credentials = credentials.substring(authMethod.length()+1); // strip off the "NTLM " or "Negotiate "
            credentials = new String(Base64.decode(credentials)); // decode the base64
            String domain = credentials.substring(0, credentials.indexOf("\\"));
            String user = credentials.substring(domain.length()+1, credentials.indexOf(":"));
            String password = credentials.substring(domain.length()+user.length()+2);
            Type2Message type2 = (Type2Message) message;
            flags ^= NtlmFlags.NTLMSSP_NEGOTIATE_OEM;
            message = new Type3Message(type2, password, domain, user, null, flags);
        }
        return authMethod + " " + Base64.encode(message.toByteArray());
    }
View Full Code Here

          return EncodingUtil.getAsciiString(Base64.encodeBase64(t1m.toByteArray()));

        } else {
          try
          {
          Type2Message t2m = parseType2Message(message);
         
          t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_SIGN,true);
          t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_SEAL,true);
          t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_NTLM2,true);
          t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_128,true);
          // The below constructor of Type3Message of jcifs library has been changed
          // to fix issues while updating latest jcifs-1.3.5.jar in SP connector.
          // The extra parameter int represents flag to support ntlm2, support message integrity,
          // confidentiality, session security and 128-bit encryption while creating TYpe3Message.
          // As the immediate lines of code below to the constructor set all these required flags, passing 0 as a parameter/falg to create
View Full Code Here

     
      return t1m.toString();
    } else {
      try
      {
      Type2Message t2m = parseType2Message(message);
     
      t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_SIGN,true);
      t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_SEAL,true);
      t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_NTLM2,true);
      t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_128,true);
      // The below constructor of Type3Message of jcifs library has been changed
      // to fix issues while updating latest jcifs-1.3.5.jar in SP connector 2.8v.
      // The extra parameter int represents flag to support ntlm2, support message integrity,
      // confidentiality, session security and 128-bit encryption while creating TYpe3Message
      // object.as the immediate lines of code below to this constructor set all these required flags, passing 0 as a parameter/falg to create
View Full Code Here

     * hashing the password.
     */
    public Type2Message parseType2Message(String message) throws IOException{
        // Decode the message first.
        byte[] msg = Base64.decodeBase64(EncodingUtil.getBytes(message, DEFAULT_CHARSET));
        Type2Message t2m = new Type2Message(msg);
       
        t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_SIGN,true);
        t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_SEAL,true);
        t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_NTLM2,true);
        t2m.setFlag(NtlmSsp.NTLMSSP_NEGOTIATE_128,true);

        return t2m;
    }
View Full Code Here

TOP

Related Classes of jcifs.ntlmssp.Type2Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.