How to install VPN root certificate in iOS Profile & Device Management and Trust Store Programmatically?

I am using NEVPNManager & IKEV2 certificate as my authentication method for connecting to the VPN. I am able to connect to the VPN. Below mentioned is my sample block of code.


     guard let path = Bundle.main.path(forResource: VPNConstants.certificateName, ofType: ".p12")  else {
            fatalError("Unable to find Certificate")
        }
        do {
            let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)
            ikev2.identityData = data
        }
        catch {
            fatalError("Unable to find Certificate")
        }
        ikev2.identityDataPassword = VPNConstants.password 

I tried to install the root certificate using SecCertificateCreateWithData and SecItemAdd methods part of the Security framework, I don't get any errors installing the certificate, but it doesn't appear in my iOS Profile & Device Management and TrustStore.

Any help is appreciated, Thanks in advance!!!


Posted on Jun 30, 2020 4:57 AM

Reply

Similar questions

1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to install VPN root certificate in iOS Profile & Device Management and Trust Store Programmatically?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.