2016-06-14 3 views
2

Xamarin.iOS에서 Google의 서비스 계정을 사용하려고했습니다. System.Security.Cryptography.X509Certificates는 PCL 프로젝트에서 지원되지 않으므로 X509Certificate를 프로젝트에로드하려면 Bouncy Castle 또는 PCLCrypto와 같은 다른 방법이 필요합니다.Bouncy Castle 프로젝트에 X.509 v.3 Google 인증서를 추가하는 방법 #

var certificate = new X509Certificate2(@"key.p12", "notasecret", X509KeyStorageFlags.Exportable); 

     ServiceAccountCredential credential = new ServiceAccountCredential(
      new ServiceAccountCredential.Initializer(serviceAccountEmail) 
      { 
       Scopes = new[] { PlusService.Scope.PlusMe } 
      }.FromCertificate(certificate)); 

질문은, 탄력이 성에서 인증서로드 (코드의 첫 번째 줄)의 또 다른 방법 무엇이다 : 기본적으로, 구글의 문서로, 인증서를 추출하는 방법은 다음과 같습니다?

답변

0

PCL 프로젝트의 대상을 .NET Standard로 변경할 수 있습니다. 이 후,

System.Security.Cryptography.X509Certificates

지원됩니다.

다음 단계를 수행 할 수 있습니다

  1. 당신의 PCL 프로젝트에서 속성 라이브러리에
  2. 클릭
  3. 클릭 대상 .NET에서 플랫폼 표준
  4. 클릭을 마우스 오른쪽 단추로 클릭
  5. 수락
  6. project.json으로 이동하여 다음을 추가하십시오. "netstandard1.3": { "imports": "portable-net45+win8+wp8+wpa81"}
  7. 너겟 패키지를 추가하십시오.

4 단계의 경우 모든 너겟 패키지를 제거해야하며 6 단계 후에 해당 단계를 다시 설치해야합니다.

관련 문제