Examples of Type2Message


Examples of jcifs.ntlmssp.Type2Message

  public Type2Message negotiateType2Message(byte[] material, byte[] serverChallenge)
    throws IOException {

    Type1Message type1Message = new Type1Message(material);

    Type2Message type2Message = new Type2Message(
      type1Message.getFlags(), serverChallenge, _domain);

    if (type2Message.getFlag(
        _NTLMSSP_NEGOTIATE_EXTENDED_SESSION_SECURITY)) {

      type2Message.setFlag(NtlmFlags.NTLMSSP_NEGOTIATE_LM_KEY, false);
      type2Message.setFlag(NtlmFlags.NTLMSSP_NEGOTIATE_TARGET_INFO, true);
      type2Message.setTargetInformation(getTargetInformation());
    }

    return type2Message;
  }
View Full Code Here

Examples of jcifs.ntlmssp.Type2Message

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

    public String generateType3Msg(String username, String password, String domain, String workstation, String challenge)
            throws NTLMEngineException {
        Type2Message t2m;
        try {
            t2m = new Type2Message(Base64.decode(challenge));
        } catch (IOException ex) {
            throw new NTLMEngineException("Invalid Type2 message", ex);
        }
        Type3Message t3m = new Type3Message(t2m, password, domain, username, workstation);
        return Base64.encode(t3m.toByteArray());
View Full Code Here

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

Examples of jcifs.ntlmssp.Type2Message

            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

Examples of jcifs.ntlmssp.Type2Message

        }
        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

Examples of jcifs.ntlmssp.Type2Message

          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

Examples of jcifs.ntlmssp.Type2Message

     
      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

Examples of jcifs.ntlmssp.Type2Message

     * 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
Copyright © 2018 www.massapi.com. 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.