我有一些守则需要与X509证书资料合作。 我下载了一个样本:
const string CertWithoutPrivateKey = "MII....";
const string CertWithPrivateKey = "MII...";
public static SecurityToken GetSigningToken(bool includePrivateKey)
{
X509Certificate2 cert = null;
if (includePrivateKey)
{
cert = new X509Certificate2(
Convert.FromBase64String(CertWithPrivateKey),
"pw", X509KeyStorageFlags.PersistKeySet);
}
else
{
cert = new X509Certificate2(
Convert.FromBase64String(CertWithoutPrivateKey));
}
return cert;
}
该法典需要能够与私人钥匙接触。 2. Saml2Authentication 模块(从《SAML2.0议定书》的WIF延伸到)依靠这一私人钥匙来解脱从SAML识别供应商发送的加密信息。
我不知道证书或加密,但在我看来,将证书硬化为一类并不可靠。
www.un.org/Depts/DGACM/index_spanish.htm 因此,我的法典应如何把ert子与私人钥匙重新联系起来? Afaik,这部法律只是一个时间来评估启动(很可能也是在回收池之后)。
我可以:
- Store the cert as an appSetting in config file. As long as appSettings are config encrypted, is this secure?
- Store the cert in a database.
- Store the cert as a file in bin/App_Data. Afaik this means it could not be read over the web, but would be in plain view to anyone who can access the host server. Imo if someone can get into my server, letting them read this cert is probably the least of my worries.
是否有任何其他选择? 本案最合适些什么?