locked
using .cer .p12 certificates in ASP.NET Core RRS feed

  • Question

  • User-1042970710 posted

    Hi Friends,

    I am going to use ASP.NET Core Razor Pages with WCF

    Calling the WCF URL Requires certificate .cer, .p12   Can any expert advice me how to use these certificates in ASP.NET Core?

    Or just installing the certificates in the key store will solve the problem?

    Thanks.

    Monday, December 14, 2020 5:53 AM

All replies

  • User1535942433 posted

    Hi jalali,

    Accroding to your description,as far as I think,WCF was the way to do communication on the Microsoft platform based on SOAP protocol.

    So,first you need to connect SOAP Service from .Net Core.You could create instance of SOAP client.And then,you could get and add the certificate to the client.You must verified that the certificate is valid and  connect to the service using the SoapUI toolset.

    Just like this:

    var myCertificate = await GetMyCertificate(); //X509Cert
    var binding = new BasicHttpsBinding()
    {
        Name = "basic_ssl_cert"
    };
    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
    QaPaymentService.PaymentOnlineService_v2_Client soapClient = new QaPaymentService.PaymentOnlineService_v2_Client(binding, new EndpointAddress(onlinePaymentServiceEndpoint));
    soapClient.ClientCredentials.ClientCertificate.Certificate = myCertificate;

    More details,you could refer to below article:

    https://stackoverflow.com/questions/57331142/net-core-connected-service-with-ssl-certificate

    Best regards,

    Yijing Sun

    Tuesday, December 15, 2020 5:47 AM