Consuming a secure webservice using x509 cert (p12)

Discussion in 'ASP .Net Web Services' started by charlief1975, May 19, 2005.

  1. charlief1975

    charlief1975 Guest

    This code works in a WinForm app. Can't get it to work in an asp.net app. I
    don't have control over the service. Don't know what language it is...just
    what it exposes.

    I have a class. This class contains all my functions to work with the
    service. In the new section for the class I have the following:
    Public Sub New()

    Dim Store As X509CertificateStore =
    X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore)

    Dim MatchingCertificates As X509CertificateCollection

    Try
    If Not Store.OpenRead() Then
    Throw New Exception("Unable to open local machine
    certificate store")
    End If

    'try to find our certificate

    MatchingCertificates =
    Store.FindCertificateBySubjectString("AllInternetNow 1-allinternetnow")

    If (MatchingCertificates.Count = 0) Then
    Throw New Exception("Unable to locate certificate in the
    local machine store")
    End If

    Service = New ServiceGatewayService

    '* configure the service URL
    Service.Url = WEBSERVICE_URL

    '* add the certificate for identification
    Service.ClientCertificates.Add(MatchingCertificates(0))

    Finally
    Store.Dispose()
    End Try

    End Sub


    The new section loads the cert from the maching keystore. Seems to
    work...looks like is added to the service object.

    Then I call a function with this code:

    Dim req As New comsbciotlinequalLineQualRequest
    Dim rsp As New comsbciotlinequalLineQualResponse

    With req
    .clientID = USERNAME
    .clientPassword = PASSWORD
    .workingTN = phoneNumber
    .requestType = "1"
    .appVersion = "1"
    '.promo = PROMOCODE
    End With

    rsp = Service.processLineQual(req)


    Return rsp

    Service.processline never returns anything. I checked with the service
    provider and in their log they see a 403 error. I got 403 errors before and
    it was a certificate problem on my side. As I said before, it works in a
    winform app, so cert is correctly installed.

    I have tried impersonation, but open to anything. Any info would be great.

    Thanks
     
    charlief1975, May 19, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Chan via .NET 247
    Replies:
    1
    Views:
    355
    Dominick Baier [DevelopMentor]
    Jun 2, 2005
  2. Keyset does not exist X509Certificate

    Keyset does not exist at Microsoft.Web.Services.Security.X509.X509

    Keyset does not exist X509Certificate, Jun 12, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    214
    Keyset does not exist X509Certificate
    Jun 12, 2004
  3. gardavis
    Replies:
    0
    Views:
    253
    gardavis
    Jul 2, 2004
  4. Bat'on

    Websevice secured with X509 cert (ssl)

    Bat'on, Feb 2, 2005, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    131
    JerryK
    Mar 9, 2005
  5. marc spitzer

    How do I decode/parse a X509 SSL Cert

    marc spitzer, Sep 3, 2009, in forum: Ruby
    Replies:
    2
    Views:
    231
    yermej
    Sep 4, 2009
Loading...

Share This Page