none
certificate reference for WCF RRS feed

  • General discussion

  • I have defined a client for a web service secured by a certificate.

    I want to use the following code to instantiate the web client and set the credential for the client.

                ws1 = New CDPHService.CDPH_transferPortTypeClient(contractName, EndPoint)

            Try

                ws1.ClientCredentials.ClientCertificate.SetCertificate( _
                    System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser, _
                    System.Security.Cryptography.X509Certificates.StoreName.My, _
                    System.Security.Cryptography.X509Certificates.X509FindType.FindByApplicationPolicy, _
                    "cdph")
            Catch ex As Exception
                MsgBox("set certificate error " + Err.Number.ToString + Chr(10) + ex.Message)
            End Try

    This system is running Windows 8.1 Pro,  I am developing in Visual Basic with Visual Studio 2012.  The application references .Net Framework 4

    Windows 8.1 certificate manager shows the certificate with the friendly name "cdph"

    The MSDN reference for X509FindType.FindByApplicationPolicy states specifically that FindByApplicationPolicy wants a string with the application policy friendly name.  ( http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509findtype(v=vs.110).aspx)

    FindByApplicationPolicy The findValue parameter for the Find method must be a string representing either the application policy friendly name or the object identifier (OID, orOid) of the certificate. For example, "Encrypting File System" or "1.3.6.1.4.1.311.10.3.4" can be used. For an application that will be localized, the OID value must be used, because the friendly name is localized.

    When the SetCertificate statement is executed, it returns error 5 The OID value was invalid.

    Why would that error be generated? Or more generally - why isn't the certificate being found?

    Jim

    LIMS Consultant

    BtB Software

    Wednesday, May 28, 2014 7:27 PM

All replies

  • Might ask them over here.

    Microsoft ASP.Net forums

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Thursday, May 29, 2014 12:32 AM
    Moderator