How to sign a private key in RSA X509 certificate

Newbie here. I am tasked with processing x509certificatein swift. This thing seems to x509sound scary. I'm struggling to describe what I want to achieve. I hope you can guide me.

Below I am trying to achieve:

1) I would like to know what I need in Swift to handle x509certificate p12 file and private Key
2) How to subscribe with RSA private key

In C # below, the code should get the private key

public static RSACryptoServiceProvider UsePrivateKeyFromP12(string certFileName, string pwd)
{

var privateCert = new X509Certificate2(System.IO.File.ReadAllBytes(certificateFileName), password);

 return (RSACryptoServiceProvider)privateCert.PrivateKey;
}

How could I do this in Swift? The private key will be on the client side.

thank

+4
source share

Source: https://habr.com/ru/post/1684790/


All Articles