Max*_*Max 8 .net certificate azure x509certificate wif
我正在尝试创建我们自己的WIF身份提供程序并在Azure上运行它,但在尝试自动生成联合元数据时我正在努力.
此行似乎不适用于Azure:
CertificateUtil.GetCertificate(StoreName.My, StoreLocation.LocalMachine, signingCertificateName);
Run Code Online (Sandbox Code Playgroud)
证书上传到Azure,我该如何获取它?
谢谢
作为其他答案的略微变化,如果您只想获得一个证书而不是遍历所有证书,您可以执行以下操作:
var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection matchedCertificates =
store.Certificates.Find(X509FindType.FindBySubjectName, signingCertificateName, true);
if (matchedCertificates.Count > 0)
{
myCertificate = matchedCertificates[0];
}
Run Code Online (Sandbox Code Playgroud)
(这也不是Azure特定的)
试试这篇博文:http: //blogs.msdn.com/b/jnak/archive/2010/01/29/installing-certificates-in-windows-azure-vms.aspx
它建议代码如下:
X509Certificate2Collection selectedCerts = new X509Certificate2Collection();
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);
foreach (X509Certificate2 cert in store.Certificates)
{
// do stuff with cert
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5344 次 |
最近记录: |