Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

First data api certificate creation error in asp.net

I have downloaded the permission file ("1909642928.pem") from the first data website, and put it into the solution folder. While trying to create a certificate file for the application from the permission file ("1909642928.pem") downloaded from first data website, I am getting an error:

The system cannot find the file specified.

CryptographicException:

at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.X509Certificates.X509Utils._QueryCertFileType(String fileName)
at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName)   at System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(String filename)
at WebApplication3._Default.Page_Load(Object sender, EventArgs e) in e:\MY_References\TestApps\App\App\Default.aspx.cs:line 20
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)     
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I am getting error form the following line:

FDGGWSApiOrderService OrderService = new FDGGWSApiOrderService();

OrderService.Url = @"https://ws.merchanttest.firstdataglobalgateway.com/fdggwsapi/services/order.wsdl";
OrderService.ClientCertificates.Add(X509Certificate.CreateFromCertFile>(("xxx.pem")));

Please assist me if I have to do anything more to create certificate from the permission file.

like image 699
Sujith S Nair Avatar asked Feb 04 '13 09:02

Sujith S Nair


1 Answers

Check the Security permissions on the file. If the webserver user is not able to read it, it will appear as not found.

like image 77
truemedia Avatar answered Oct 01 '22 20:10

truemedia