Tag: x509certificate2

X509证书不在服务器上加载私钥文件

我正在使用Google AnalyticsAPI,并按照此问题设置了OAuth: https : //stackoverflow.com/a/13013265/1299363 这是我的OAuth代码: public void SetupOAuth () { var Cert = new X509Certificate2( PrivateKeyPath, "notasecret", X509KeyStorageFlags.Exportable); var Provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, Cert) { ServiceAccountId = ServiceAccountUser, Scope = ApiUrl + "analytics.readonly" }; var Auth = new OAuth2Authenticator<AssertionFlowClient>(Provider, AssertionFlowClient.GetState); Service = new AnalyticsService(Auth); } PrivateKeyPath是Google API控制台提供的私钥文件的path。 这在我的本地机器上完美工作,但是当我把它推到我们的testing服务器上时, System.Security.Cryptography.CryptographicException: An internal error occurred. 与下面的堆栈跟踪(不相关的部分删除): […]