HttpWebRequest encryption?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Cronin via DotNetMonster.com

    HttpWebRequest encryption?

    Hi there,

    Can anyone tell me what level of encryption is used when making an HTTPS
    POST request through an instance of the System.Net.Http WebRequest object?

    Thanks much in advance!

    Mike Cronin
    Data On Call - Programmer

    --
    Message posted via http://www.dotnetmonster.com
  • Alvin Bruney [ASP.NET MVP]

    #2
    Re: HttpWebRequest encryption?

    what ever the server supports, not all servers support 128bit
    "Mike Cronin via DotNetMonster.c om" <forum@DotNetMo nster.com> wrote in
    message news:91087ae88e c84ead988c416a0 657d79d@DotNetM onster.com...[color=blue]
    > Hi there,
    >
    > Can anyone tell me what level of encryption is used when making an HTTPS
    > POST request through an instance of the System.Net.Http WebRequest object?
    >
    > Thanks much in advance!
    >
    > Mike Cronin
    > Data On Call - Programmer
    >
    > --
    > Message posted via http://www.dotnetmonster.com[/color]


    Comment

    • Nick Malik [Microsoft]

      #3
      Re: HttpWebRequest encryption?

      That is defined by the server certificate. For your specific site, take a
      look at the cert and you can see the level of encryption that will be used.

      --
      --- Nick Malik [Microsoft]
      MCSD, CFPS, Certified Scrummaster


      Disclaimer: Opinions expressed in this forum are my own, and not
      representative of my employer.
      I do not answer questions on behalf of my employer. I'm just a
      programmer helping programmers.
      --
      "Mike Cronin via DotNetMonster.c om" <forum@DotNetMo nster.com> wrote in
      message news:91087ae88e c84ead988c416a0 657d79d@DotNetM onster.com...[color=blue]
      > Hi there,
      >
      > Can anyone tell me what level of encryption is used when making an HTTPS
      > POST request through an instance of the System.Net.Http WebRequest object?
      >
      > Thanks much in advance!
      >
      > Mike Cronin
      > Data On Call - Programmer
      >
      > --
      > Message posted via http://www.dotnetmonster.com[/color]


      Comment

      • Mike Cronin via DotNetMonster.com

        #4
        Re: HttpWebRequest encryption?

        Thanks for your reply Nick!

        --
        Message posted via http://www.dotnetmonster.com

        Comment

        • Mike Cronin via DotNetMonster.com

          #5
          Re: HttpWebRequest encryption?

          Thanks for your reply Alvin!

          --
          Message posted via http://www.dotnetmonster.com

          Comment

          • Mike Cronin via DotNetMonster.com

            #6
            Re: HttpWebRequest encryption?

            If a 128-bit encrypted client sends an HTTPS POST request to a server that
            handles 128-bit encryption, does the client need to do anything more than
            what follows...

            String url = "https://securesite.com? user=xxx&passwo rd=yyy";
            HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(url);
            webRequest.set_ ContentType("ap plication/x-www-form-urlencoded");
            webRequest.set_ ContentLength(q uery.length());
            webRequest.set_ Method("POST");
            StreamWriter sw = new StreamWriter(we bRequest.GetReq uestStream());
            sw.Write(query. ToString());
            sw.Close();

            Under the circumstances mentioned, will this simple request produce a 128-
            bit encrypted POST?

            Is there no need to use System.Security .Cryptography.X 509Certificates ?

            I just need to be clear on the level of encryption.

            Any assistance is most appreciated!

            Mike Cronin

            --
            Message posted via http://www.dotnetmonster.com

            Comment

            • Nick Malik [Microsoft]

              #7
              Re: HttpWebRequest encryption?

              You have some pretty confused code there.

              The set_ContentType method is a method of the page object, used only on the
              server side.
              In addition, it is a method used internally by .NET and is not intended to
              be used from your code.

              Considering the fact that you are creating an HttpWebRequest object, the
              set_ContentType method doesn't apply.

              My guess is that you posted this snippet after it failed to compile...
              correct?

              A good example of the code you need can be found here
              Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


              And, yes, posting to an HTTPS URL will have the effect of encrypting the
              data in-stream. You do not need to use any encryption APIs.
              Try it for yourself. Sniff the port. (If you don't have a sniffer, you may
              want to try Ethereal or one of the other sniffing utilities that uses
              WinPCap to sniff your ports.)

              --
              --- Nick Malik [Microsoft]
              MCSD, CFPS, Certified Scrummaster


              Disclaimer: Opinions expressed in this forum are my own, and not
              representative of my employer.
              I do not answer questions on behalf of my employer. I'm just a
              programmer helping programmers.
              --
              "Mike Cronin via DotNetMonster.c om" <forum@DotNetMo nster.com> wrote in
              message news:a1065be419 8748109afaf1e25 95b34f5@DotNetM onster.com...[color=blue]
              > If a 128-bit encrypted client sends an HTTPS POST request to a server that
              > handles 128-bit encryption, does the client need to do anything more than
              > what follows...
              >
              > String url = "https://securesite.com? user=xxx&passwo rd=yyy";
              > HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(url);
              > webRequest.set_ ContentType("ap plication/x-www-form-urlencoded");
              > webRequest.set_ ContentLength(q uery.length());
              > webRequest.set_ Method("POST");
              > StreamWriter sw = new StreamWriter(we bRequest.GetReq uestStream());
              > sw.Write(query. ToString());
              > sw.Close();
              >
              > Under the circumstances mentioned, will this simple request produce a 128-
              > bit encrypted POST?
              >
              > Is there no need to use System.Security .Cryptography.X 509Certificates ?
              >
              > I just need to be clear on the level of encryption.
              >
              > Any assistance is most appreciated!
              >
              > Mike Cronin
              >
              > --
              > Message posted via http://www.dotnetmonster.com[/color]


              Comment

              • Mike Cronin via DotNetMonster.com

                #8
                Re: HttpWebRequest encryption?

                Nope the actual code compiles fine and is used to POST requests to us.

                I should have told you that I am working in J#. Using J#, I have a
                set_ContentType () not ContentType() method exposed. Sorry about the
                confusion.

                One other thing, the logic did get a bit tweaked when I modified the
                snippet for posting. The following reflects more accurately what is coded
                (the URL and query string are separated)...

                String url = "https://securesite.com" ;
                String query = "user=xxx&passw ord=yyy";
                HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(url);
                webRequest.set_ ContentType("ap plication/x-www-form-urlencoded");
                webRequest.set_ ContentLength(q uery.length());
                webRequest.set_ Method("POST");
                StreamWriter sw = new StreamWriter(we bRequest.GetReq uestStream());
                sw.Write(query. ToString());
                sw.Close();

                Nevertheless, I just wanted to make sure that in the circumstance
                previously described the resulting post would be 128-bit encrypted (one of
                our clients needs to be certain their data is 128-bit encrypted).

                You are awesome for helping out bud!

                Thanks for your quick reply!

                Mike Cronin

                --
                Message posted via http://www.dotnetmonster.com

                Comment

                • neerajb@noida.nospamhcltech.com

                  #9
                  Re: HttpWebRequest encryption?

                  I am using the following code to post data to the site on Domino server but
                  always
                  gives the following error at this line
                  Dim streamWriter = New
                  System.IO.Strea mWriter(httpWeb Request.GetRequ estStream())

                  "Operation Timed OUT"
                  or
                  "Underlying Connection is Closed.."

                  I have used the following code :

                  Dim stringPost = "Username=xxx&P assword=yyy"

                  Dim httpWebRequest As System.Net.Http WebRequest =
                  System.Net.Http WebRequest.Crea te("https://corpmis.ggn.hcl tech.com//names.nsf?Login ")


                  httpWebRequest. ContentType = "applicatio n/x-www-form-urlencoded"
                  httpWebRequest. ContentLength = stringPost.Leng th
                  httpWebRequest. Method = "POST"

                  Dim streamWriter = New
                  System.IO.Strea mWriter(httpWeb Request.GetRequ estStream())
                  streamWriter.Wr ite(stringPost)
                  streamWriter.Cl ose()

                  Dim httpWebResponse As System.Net.Http WebResponse =
                  httpWebRequest. GetResponse()
                  Dim streamReader = New
                  System.IO.Strea mReader(httpWeb Response.GetRes ponseStream())
                  Dim stringResult = streamReader.Re adToEnd()
                  streamReader.Cl ose()


                  Please Help!!!!!

                  Thanks & Regards,
                  Neeraj

                  "Mike Cronin via DotNetMonster.c om" wrote:
                  [color=blue]
                  > Nope the actual code compiles fine and is used to POST requests to us.
                  >
                  > I should have told you that I am working in J#. Using J#, I have a
                  > set_ContentType () not ContentType() method exposed. Sorry about the
                  > confusion.
                  >
                  > One other thing, the logic did get a bit tweaked when I modified the
                  > snippet for posting. The following reflects more accurately what is coded
                  > (the URL and query string are separated)...
                  >
                  > String url = "https://securesite.com" ;
                  > String query = "user=xxx&passw ord=yyy";
                  > HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(url);
                  > webRequest.set_ ContentType("ap plication/x-www-form-urlencoded");
                  > webRequest.set_ ContentLength(q uery.length());
                  > webRequest.set_ Method("POST");
                  > StreamWriter sw = new StreamWriter(we bRequest.GetReq uestStream());
                  > sw.Write(query. ToString());
                  > sw.Close();
                  >
                  > Nevertheless, I just wanted to make sure that in the circumstance
                  > previously described the resulting post would be 128-bit encrypted (one of
                  > our clients needs to be certain their data is 128-bit encrypted).
                  >
                  > You are awesome for helping out bud!
                  >
                  > Thanks for your quick reply!
                  >
                  > Mike Cronin
                  >
                  > --
                  > Message posted via http://www.dotnetmonster.com
                  >[/color]

                  Comment

                  • Feroze [msft]

                    #10
                    Re: HttpWebRequest encryption?

                    You need to run a wiresniffer like ethereal to see which side is causing the
                    timeout or connection close. It is difficult to say by looking at the code.

                    Also, if all you want to do is forms post, you should look into using
                    WebClient class. You can do a FormsPost in WebCLient in 2-3 lines of code.

                    --
                    feroze

                    -----------------
                    This posting is provided as-is. It offers no warranties and assigns no
                    rights.

                    See http://weblogs.asp.net/feroze_daud for System.Net related posts.
                    ----------------

                    "neerajb@noida. nospamhcltech.c om"
                    <neerajbnoidano spamhcltechcom@ discussions.mic rosoft.com> wrote in message
                    news:4FC7240E-3DD0-491E-B129-86DDE07143B4@mi crosoft.com...[color=blue]
                    >I am using the following code to post data to the site on Domino server
                    >but
                    > always
                    > gives the following error at this line
                    > Dim streamWriter = New
                    > System.IO.Strea mWriter(httpWeb Request.GetRequ estStream())
                    >
                    > "Operation Timed OUT"
                    > or
                    > "Underlying Connection is Closed.."
                    >
                    > I have used the following code :
                    >
                    > Dim stringPost = "Username=xxx&P assword=yyy"
                    >
                    > Dim httpWebRequest As System.Net.Http WebRequest =
                    > System.Net.Http WebRequest.Crea te("https://corpmis.ggn.hcl tech.com//names.nsf?Login ")
                    >
                    >
                    > httpWebRequest. ContentType = "applicatio n/x-www-form-urlencoded"
                    > httpWebRequest. ContentLength = stringPost.Leng th
                    > httpWebRequest. Method = "POST"
                    >
                    > Dim streamWriter = New
                    > System.IO.Strea mWriter(httpWeb Request.GetRequ estStream())
                    > streamWriter.Wr ite(stringPost)
                    > streamWriter.Cl ose()
                    >
                    > Dim httpWebResponse As System.Net.Http WebResponse =
                    > httpWebRequest. GetResponse()
                    > Dim streamReader = New
                    > System.IO.Strea mReader(httpWeb Response.GetRes ponseStream())
                    > Dim stringResult = streamReader.Re adToEnd()
                    > streamReader.Cl ose()
                    >
                    >
                    > Please Help!!!!!
                    >
                    > Thanks & Regards,
                    > Neeraj
                    >
                    > "Mike Cronin via DotNetMonster.c om" wrote:
                    >[color=green]
                    >> Nope the actual code compiles fine and is used to POST requests to us.
                    >>
                    >> I should have told you that I am working in J#. Using J#, I have a
                    >> set_ContentType () not ContentType() method exposed. Sorry about the
                    >> confusion.
                    >>
                    >> One other thing, the logic did get a bit tweaked when I modified the
                    >> snippet for posting. The following reflects more accurately what is coded
                    >> (the URL and query string are separated)...
                    >>
                    >> String url = "https://securesite.com" ;
                    >> String query = "user=xxx&passw ord=yyy";
                    >> HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(url);
                    >> webRequest.set_ ContentType("ap plication/x-www-form-urlencoded");
                    >> webRequest.set_ ContentLength(q uery.length());
                    >> webRequest.set_ Method("POST");
                    >> StreamWriter sw = new StreamWriter(we bRequest.GetReq uestStream());
                    >> sw.Write(query. ToString());
                    >> sw.Close();
                    >>
                    >> Nevertheless, I just wanted to make sure that in the circumstance
                    >> previously described the resulting post would be 128-bit encrypted (one
                    >> of
                    >> our clients needs to be certain their data is 128-bit encrypted).
                    >>
                    >> You are awesome for helping out bud!
                    >>
                    >> Thanks for your quick reply!
                    >>
                    >> Mike Cronin
                    >>
                    >> --
                    >> Message posted via http://www.dotnetmonster.com
                    >>[/color][/color]


                    Comment

                    Working...