[英]Using PEM file with multiple certificate and Private Key
I have a .PEM file that contains a private key and somehow it has 3 sets of certificates. 我有一个.PEM文件,其中包含一个私钥,并以某种方式包含3组证书。 I'm new to certificates and cant figure out how to import it to my code to be able to use it as authenticate to access clients web service.
我是证书的新手,无法弄清楚如何将其导入到我的代码中,以便能够将其用作访问客户端Web服务的身份验证。
Bag Attributes
localKeyID: 94 7D DF 3D A7 A5 8D 3F FF 73 B5 CF 44 96 4F FC DC DC 51 BB
friendlyName: Company UAT Client SSL Certificate
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
Bag Attributes
localKeyID: 94 7D DF 3D A7 A5 8D 3F FF 73 B5 CF 44 96 4F FC DC DC 51 BB
friendlyName: Company UAT Client SSL Certificate
subject=/emailAddress=ljpclat@aaaa.com.ph/UID=002/CN=Company UAT Client SSL Certificate/OU=TCMG/O=AAAA/C=PH
issuer=/CN=AAAA Company API UAT CA/OU=Information Security/O=AAAA/C=PH
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
Bag Attributes
friendlyName: AAAA Root CA
subject=/CN=AAAA Root CA/OU=Information Security/O=AAAA/C=PH
issuer=/CN=AAAA Root CA/OU=Information Security/O=AAAA/C=PH
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
Bag Attributes
friendlyName: Name CA
subject=/CN=Subject CA/OU=Information Security/O=AAAA/C=PH
issuer=/CN=AAAA Root CA/OU=Information Security/O=AAAA/C=PH
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
I have tried to use BouncyCastle - Org.BouncyCastle.X509 for C# but whenever i tried to access clients web service, I got Error (400) Bad Request. 我曾尝试将BouncyCastle-Org.BouncyCastle.X509用于C#,但是每当尝试访问客户端Web服务时,都会收到错误(400)错误请求。
I found a way to resolve my issue by converting PEM file into PFX/PKCS#12 format using openssl (or you can visit - https://www.sslshopper.com/ssl-converter.html if you dont have one installed) and then importing my certificate using X509Certificate2 in my code. 我找到了一种方法,通过使用OpenSSL的PEM文件转换成PFX / PKCS#12格式来解决我的问题(或者您可以访问- https://www.sslshopper.com/ssl-converter.html如果你没有安装)和然后在代码中使用X509Certificate2导入我的证书。 And everything else I based here - https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.import?view=netframework-4.8
以及我在此处基于的所有其他内容-https: //docs.microsoft.com/zh-cn/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.import?view=netframework - 4.8
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.