After install Linux netcore, to deploy on Linux, certificate copies from the window to/root/under Linux. The dotnet/corefx/cryptography/x509stores path below
But under Linux execution of a piece of code below, always can't find the certificate, strives for the great god of action!
X509Store store=new X509Store (StoreName. Root);
Store. The Open (OpenFlags. ReadWrite);
X509Certificate2Collection certs=store. Certificates. The Find (X509FindType FindBySubjectName, "TestServer", false);//vaildOnly=true when search results,
If (certs. Count==0) return;
ServerCertificate=certs [0];
Store. The Close ();//close the store,
In addition, I try the following to create the way to abnormal: error: 2006 d080: BIO routines: BIO_new_file: no to the file
Using (var store=new X509Store (StoreName. My, StoreLocation. CurrentUser))
{
Store. The Open (OpenFlags. ReadWrite);
Var cert=new X509Certificate2 (" certfo. PFX ", "1234");
Store. The Add (cert);
}
CodePudding user response:
Top, also don't know whether I should go to Linux