I also reproduced the same error and I created my p12 file with "step certificate" command on Windows WSL. How can I tell if my issue has the same root cause and how to fix it? This is how I created the my certificates:
Create self-signed ca:
--deployment-type standalone
--name MqttAppSamplesCA
--dns localhost
--address 127.0.0.1:443
--provisioner MqttAppSamplesCAProvisioner
Create client crt and key files:
--deployment-type standalone
--name MqttAppSamplesCA
--dns localhost
--address 127.0.0.1:443
--provisioner MqttAppSamplesCAProvisioner
Create p12 file:
step certificate p12 sample_client3.p12 sample_client3.pem sample_client3.key --password-file=password.txt
Call:
let clientCertPath = Bundle.main.path(forResource: "sample_client3", ofType: "p12")
let status = loadP12(filename: clientCertPath!, password: password)
public static func loadP12(filename: String, password: String) throws -> OSStatus {
let data = try Data(contentsOf: URL(fileURLWithPath: filename))
let options: [String: String] = [kSecImportExportPassphrase as String: password]
var rawItems: CFArray?
return SecPKCS12Import(data as CFData, options as CFDictionary, &rawItems)
}
Topic:
App & System Services
SubTopic:
Core OS
Tags: