首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >配置.pfx证书

配置.pfx证书
EN

Stack Overflow用户
提问于 2021-04-24 18:50:55
回答 1查看 63关注 0票数 0

我正在使用.Net 5.0,当我把它扔到托管服务器上时,我得到了这些错误。一段时间后,由于这些错误,我的网站显示HTTP错误500。我用OpenSSL和用户配置文件创建了证书,但当我尝试添加证书时,我得到了这些错误。

我该怎么做呢?

代码语言:javascript
复制
  warn: Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository[50]
          Using an in-memory repository. Keys will not be persisted to storage.
    warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[59]
          Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
    warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
          No XML encryptor configured. Key {f071590d-e902-4b6f-bbbe-d27d7415d96b} may be persisted to storage in unencrypted form.
    crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
          Application startup exception
          Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: The system cannot find the file specified.

我的初创公司是这样的:

代码语言:javascript
复制
services.AddDataProtection()
            .SetApplicationName("MyProjectName")
            .ProtectKeysWithCertificate(new X509Certificate2(certificate, "password", X509KeyStorageFlags.MachineKeySet
                             | X509KeyStorageFlags.PersistKeySet
                             | X509KeyStorageFlags.Exportable))  //My bad line of code
                   .UseCryptographicAlgorithms(
                    new AuthenticatedEncryptorConfiguration()
                    {
                        EncryptionAlgorithm = EncryptionAlgorithm.AES_256_CBC,
                        ValidationAlgorithm = ValidationAlgorithm.HMACSHA256
                    }
             )
             .PersistKeysToFileSystem(new DirectoryInfo(keysFolder)) //shared network folder for key location
             .SetDefaultKeyLifetime(TimeSpan.FromDays(600));
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-27 21:46:29

问题是在服务器端已经过时了。提供程序更新了服务器,问题已解决

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67241950

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档