使用具有多个证书和私钥的 PEM 文件
Using PEM file with multiple certificate and Private Key
我有一个包含私钥的 .PEM 文件,不知何故它有 3 套证书。我是证书的新手,无法弄清楚如何将其导入我的代码以便能够将其用作访问客户端 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-----
我曾尝试使用 BouncyCastle - Org.BouncyCastle.X509 for C# 但每当我尝试访问客户端 Web 服务时,我都会收到错误 (400) 错误请求。
我通过使用 openssl(或你可以访问 - https://www.sslshopper.com/ssl-converter.html if you dont have one installed) and then importing my certificate using X509Certificate2 in my code. And everything else I based here - https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.import?view=netframework-4.8
我有一个包含私钥的 .PEM 文件,不知何故它有 3 套证书。我是证书的新手,无法弄清楚如何将其导入我的代码以便能够将其用作访问客户端 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-----
我曾尝试使用 BouncyCastle - Org.BouncyCastle.X509 for C# 但每当我尝试访问客户端 Web 服务时,我都会收到错误 (400) 错误请求。
我通过使用 openssl(或你可以访问 - https://www.sslshopper.com/ssl-converter.html if you dont have one installed) and then importing my certificate using X509Certificate2 in my code. And everything else I based here - https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.import?view=netframework-4.8