AzureにApp-serviceがあり、AzureServiceManagementAPIで作業していたときに、各サブスクリプションのmanagememnt証明書を含むファイルをダウンロードしていました。Azure、App-service、文字列からX509Certificate2オブジェクトを作成
どのように私はX509Certificate2オブジェクトを作成しようとしているファイルから証明書文字列を使用します。
string cerStr = subscription.Attribute("ManagementCertificate").Value;
X509Certificate2 x509 = new X509Certificate2(Convert.FromBase64String(cerStr), string.Empty, X509KeyStorageFlags.MachineKeySet)
X509Certificate2のコンストラクタは、アクセスが拒否された例外
を投げます。 System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlobで
System.Security.Cryptography.CryptographicException.ThrowCryptographicException(のInt32 HR)(バイト[] RAWDATA、のIntPtrパスワード、UInt32型dwFlagsパラメータ、ブールpersistKeySet、 SafeCertContextHandle & System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(バイト[] RAWDATA、オブジェクトのパスワード、X509KeyStorageFlags keyStorageFlags)
からの抜粋コードは、あなたがX509KeyStorageFlags.UserKeySetを試みたことがありますか? –