我们有一个应用程序,该应用程序在Android中使用X509CertificateHolder,BouncyCastleProvider,PEMParser创建用于通过SSL进行MQTT连接的X.509证书。
我们有一个类似的iOS应用,其中我使用MQTTClient library进行MQTT连接,该连接需要der格式的X.509证书文件才能评估SSL连接。 我们正在通过网络接收关注。
- CA证书作为字符串=“----- BEGIN CERTIFICATE ----- \ r \ nyjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL \ r \ nExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp \ r \ nU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW \ r \ nZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 \ r \ naG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL \ r \ nMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW \ r \ nZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln \ r \ nbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp \ r \ nU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y \ r \ naXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1 \ r \ nnmAMqudLO07cfLw8RRy7K + d + KQL5VwijZIUVJ / XxrcgxiV0i6CqqpkKzj / i5Vbex \ r \ nt0uz / O9 + B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6 / WhkcIz \ r \ nSdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG \ r \ NBO + QueQA5N06tRn / Arr0PO7gi + S3I + z016zy9vA9r911kTMZHRxAy3QkGSGT 2RT + \ r \ nrCpSx4 / VBEnkjWNHiDxpg8v + R70rfk / Fla4OndTRQ8Bnc + MUCH7lP59zuDMKz10 / \ r \ nNIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH / BAUwAwEB / zAOBgNVHQ8BAf8E \ r \ nBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH \ r \ nBgUrDgMCGgQUj + XTGoasjY5rw8 + AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy \ r \ naXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH / TZafC3ey78DAJ80M5 + GKV \ r \ nMzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE \ r \ np6B4Eq1iDkVwZMXnl2YtmAl + X6 / WzChl8gGqCBpH3vn5fJJaCGkgDdk + bW48DW7Y \ r \ n5gaRQBi5 + MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK \ r \ nWE9gyn6CagsCqiUXObXbf + eEZSqVir2G3l6BFoMtEMze / aiCKm0oHw0LxOXnGiYZ \ r \ n4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N \ r \ n ----- END CERTIFICATE -----“
- 客户证书为字符串“ ----- BEGIN CERTIFICATE ----- END CERTIFICATE”
- 客户端密钥和密码
我们如何在Swift中根据上述信息创建X.509证书?