'How send an https request in swift with .crt and .key files

I'm developing an ios (ipad) application with swift. I'm able to send an http request with a URLSession object and it works well. Now I would like to know how send an httpS request using my .crt and .key files. Does someone has a simple piece of code to do this ? Thanks in advance.



Solution 1:[1]

There is a good solution here but it works with p12

To convert to p12 I used this in the terminal)

openssl pkcs12 -export -in server.crt -inkey server.key -out cert.p12

https://github.com/MarcoEidinger/ClientCertificateSwiftDemo

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Radomyr Sidenko