在 Windows 运行时加载带有私钥的证书
Load Certificate with Private Key in Windows Runtime
我正在尝试从 UWP 应用程序中打包的 .DER 文件加载 Windows.Security.Cryptography.Certificates.Certificate。阅读 the documentation 只告诉我 ctor 需要 DER 编码证书。我尝试使用 openssl 创建此证书,但我注意到每当我从构造函数加载证书时它都会丢失密钥。
我应该如何从 UWP 应用程序中的文件加载证书?
我不熟悉 UWP 应用程序,但根据文档,Windows.Security.Cryptography.Certificates.Certificate 的构造函数只需要证书,而不需要带有私钥的 PKCS#12 证书。文档提到了 .cer(没有私钥的证书)和 .p7b(PKCS#7 容器中的证书或证书链)。
您可以使用方法 ImportPfxDataAsync or other overload of this method. Then you could fetch the certificate from certificate store using method FindAllAsync.
将证书和私钥导入用户存储
我正在尝试从 UWP 应用程序中打包的 .DER 文件加载 Windows.Security.Cryptography.Certificates.Certificate。阅读 the documentation 只告诉我 ctor 需要 DER 编码证书。我尝试使用 openssl 创建此证书,但我注意到每当我从构造函数加载证书时它都会丢失密钥。
我应该如何从 UWP 应用程序中的文件加载证书?
我不熟悉 UWP 应用程序,但根据文档,Windows.Security.Cryptography.Certificates.Certificate 的构造函数只需要证书,而不需要带有私钥的 PKCS#12 证书。文档提到了 .cer(没有私钥的证书)和 .p7b(PKCS#7 容器中的证书或证书链)。
您可以使用方法 ImportPfxDataAsync or other overload of this method. Then you could fetch the certificate from certificate store using method FindAllAsync.
将证书和私钥导入用户存储