【发布时间】:2017-05-26 00:00:31
【问题描述】:
我一直在尝试在 Xamarin.iOS 上使用 Google 的服务帐户。 PCL 项目不支持 System.Security.Cryptography.X509Certificates,因此我需要不同的方式(如 Bouncy Castle 或 PCLCrypto)将 X509Certificate 加载到项目中。基本上,和谷歌文档中一样,提取证书的方式如下:
var certificate = new X509Certificate2(@"key.p12", "notasecret", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { PlusService.Scope.PlusMe }
}.FromCertificate(certificate));
问题是,在 Bouncy Castle 中加载证书(代码的第一行)的替代方法是什么?
【问题讨论】:
标签: c# xamarin x509certificate2 service-accounts