NTLM Authentication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander Gnauck

    NTLM Authentication

    Hello,

    i need to perform NTML Authentication with SMTP against a exchange server. I
    cant use existing libraries like CDO. The type1 and type2 mesages work OK.
    Now i have to create the type3 message to authenticate. Are there any .NET
    classes that i could use to create the NTLM response? Or smth else that can
    do the NTLM authentication for me?

    Thanx Alex


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: NTLM Authentication

    Alexander,

    You are handling the NLTM authentication yourself? I think that is not
    a good idea, since you probably will not get it right, and if you do, you
    will have to maintain that code.

    Why can't you use libraries like CDO?

    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Alexander Gnauck" <gnauck@ag-software.de> wrote in message
    news:2p3hnhFg15 j9U1@uni-berlin.de...[color=blue]
    > Hello,
    >
    > i need to perform NTML Authentication with SMTP against a exchange server.
    > I cant use existing libraries like CDO. The type1 and type2 mesages work
    > OK. Now i have to create the type3 message to authenticate. Are there any
    > .NET classes that i could use to create the NTLM response? Or smth else
    > that can do the NTLM authentication for me?
    >
    > Thanx Alex
    >[/color]


    Comment

    • Alexander Gnauck

      #3
      Re: NTLM Authentication

      hello,
      [color=blue]
      > You are handling the NLTM authentication yourself? I think that is not
      > a good idea, since you probably will not get it right, and if you do, you
      > will have to maintain that code.[/color]

      yes i handle it myself. I have seen internal classes in the framework with
      the Reflector that are sealed :(. So i have no other chance i think.
      [color=blue]
      > Why can't you use libraries like CDO?[/color]

      only one reason is that there is no support for Socks 4 and 5 Proxies in
      CDO. What do you mean with "maintain the code"?

      Alex



      Comment

      • Willy Denoyette [MVP]

        #4
        Re: NTLM Authentication

        Alexander,

        Following [1] article explains how one can add NTLM/Kerberos authentication
        handshake protocols to the remoting channels. It includes a module
        (Microsoft.Samp les.Security.SS PI) written in MC++ (sources included) that
        uses spnego (and SSPI) to handle authentication handshakes. I'm sure this is
        what you are looking for.

        Willy.

        [1]


        "Alexander Gnauck" <gnauck@ag-software.de> wrote in message
        news:2p3hnhFg15 j9U1@uni-berlin.de...[color=blue]
        > Hello,
        >
        > i need to perform NTML Authentication with SMTP against a exchange server.
        > I cant use existing libraries like CDO. The type1 and type2 mesages work
        > OK. Now i have to create the type3 message to authenticate. Are there any
        > .NET classes that i could use to create the NTLM response? Or smth else
        > that can do the NTLM authentication for me?
        >
        > Thanx Alex
        >[/color]


        Comment

        • Alexander Gnauck

          #5
          Re: NTLM Authentication

          Hello,

          found a Java Library at http://jcifs.samba.org/ and managed c# code from
          Mono. So i extended this code a bit and it works pretty well. Similar code
          is already in the Framework. Why does Microsoft seal this classes? Much
          easier to develop with Mono here.

          Alex


          Comment

          • Willy Denoyette [MVP]

            #6
            Re: NTLM Authentication

            Not sure why you don't simply use System.Web.Mail here to connect to
            Exchange server using smtp?
            The Mailmessage class makes it possible to select NTLM as authentication
            protocol when connecting to Exchange.

            Here is how you could do this:

            MailMessage mail = new MailMessage();
            .....
            mail.Fields.Add ("http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e",
            "2"); // select NTLM (2) authentication

            // add user and password
            mail.Fields.Add (http://schemas.microso ft.com/cdo/configuration/sendusername",
            "usernameHere") ;
            mail.Fields.Add (http://schemas.microso ft.com/cdo/configuration/sendpassword",
            "userPwd");

            SmtpMail.Send( mail );

            Willy.



            "Alexander Gnauck" <gnauck@ag-software.de> wrote in message
            news:2p5rpaFh54 edU1@uni-berlin.de...[color=blue]
            > Hello,
            >
            > found a Java Library at http://jcifs.samba.org/ and managed c# code from
            > Mono. So i extended this code a bit and it works pretty well. Similar code
            > is already in the Framework. Why does Microsoft seal this classes? Much
            > easier to develop with Mono here.
            >
            > Alex
            >[/color]


            Comment

            • Alexander Gnauck

              #7
              Re: NTLM Authentication

              > Not sure why you don't simply use System.Web.Mail here to connect to[color=blue]
              > Exchange server using smtp?[/color]

              because it has no support for SOCKS4, SOCKS5 and other Proxies i need. Also
              this class is only a wrapper to cdo which is not available on 9x Systems.

              Alex


              Comment

              Working...