简体   繁体   中英

How to create a Certificate Signing Request on Xamarin

How can we generate a certificate signing request (CSR) on Xamarin platforms.

CertificateRequest can be used for this in desktop .net however Xamarin/mono platforms do not support it, It throws a PlatformNotSupportedException.

The c# version of SandCastle supports creating Certificate Signing Requests (CSR)

 byte[] CreateSigningRequest(string commonName, RSA rsa)
 {
     var name = new X509Name($"C=NZ, O=MyOrg, L=MyLocation, OU=MyOrgUnit, CN={commonName}");
     var keys = DotNetUtilities.GetKeyPair(rsa);
     Pkcs10CertificationRequest csr = new Pkcs10CertificationRequest("SHA256WITHRSA", name, keys.Public, null, keys.Private);
     return csr.GetEncoded();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM