自己署名証明書 (c#) を使用しようとしています:
X509Certificate2 cert = new X509Certificate2(
Server.MapPath("~/App_Data/myhost.pfx"), "pass");
共有 Web ホスティング サーバーでエラーが発生しました。
System.Security.Cryptography.CryptographicException: An internal error occurred.
スタック トレースは次で終了します
System.Security.Cryptography.CryptographicException.
ThrowCryptogaphicException(Int32 hr) +33
System.Security.Cryptography.X509Certificates.X509Utils.
_LoadCertFromFile(String fileName, IntPtr password, UInt32 dwFlags,
Boolean persistKeySet, SafeCertContextHandle& pCertCtx) +0
System.Security.Cryptography.X509Certificates.X509Certificate.
LoadCertificateFromFile(String fileName, Object password,
X509KeyStorageFlags keyStorageFlags) +237
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(
String fileName, String password) +131
私の開発マシンでは、問題なくロードされます。秘密鍵アクセスが必要なため、*.cer ファイルではなく *.pfx をロードする理由 (cer ファイルは正常にロードされます)。私は自分のdev mochineでpfxを次のように作成しました:
makecert -r -n "CN=myhost.com, E=admin@myhost.com" -sky exchange -b 01/01/2009
-pe -sv myhost.pvk myhost.cer
<b>pvk2pfx</b> -pvk myhost.pvk -spc myhost.cer -pfx myhost.pfx -po pass</code>
makecert のバージョン v5.131.3790.0 を使用しています