I have been trying to use Google's service account on Xamarin.iOS. System.Security.Cryptography.X509Certificates is not supported for PCL projects so i need a different way(like Bouncy Castle or PCLCrypto) to load X509Certificate into the project. Basically, as in the Google's document, the way of extracting the certificate is as following:
var certificate = new X509Certificate2(@"key.p12", "notasecret", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { PlusService.Scope.PlusMe }
}.FromCertificate(certificate));
The question is that, what is the alternative way of loading certificate(the first line of the code) in Bouncy Castle ?
You can change the Target of your PCL project to .NETStandard. After this,
System.Security.Cryptography.X509Certificates
is supported.
You can do it with the following steps:
"netstandard1.3": { "imports": "portable-net45+win8+wp8+wpa81"}
For step 4 you must remove all your Nuget packages and after step 6 you must reinstall their.
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.