Re: container name
- From: Dominick Baier [DevelopMentor] <dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 23 Feb 2006 02:38:38 +0000 (UTC)
hi,
this might help:
// user store is default store
StoreLocation location = StoreLocation.CurrentUser;
// open store
X509Store store = new X509Store(StoreName.My, location);
store.Open(OpenFlags.ReadOnly);
// select certificate
X509Certificate2Collection col = X509Certificate2UI.SelectFromCollection(
store.Certificates, "www.leastprivilege.com", "Select a Certificate", X509SelectionFlag.SingleSelection);
store.Close();
if (col.Count != 1)
return;
// get path and filename of private key containers
string keyfileName = GetKeyFileName(col[0]);
private static string GetKeyFileName(X509Certificate2 cert)
{
string filename = null;
if (cert.PrivateKey != null)
{
RSACryptoServiceProvider provider = cert.PrivateKey as RSACryptoServiceProvider;
filename = provider.CspKeyContainerInfo.UniqueKeyContainerName;
}
return filename;
}
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
hello,
how i can get the key container name for each certificate in
the
my personal store
if i create the certificate using makecert.exe then i am able to
explicitly mention certificate key container name but if i have
certificate from the certififying authority how would i get the key
container name
please help me out
.
- References:
- container name
- From: nishu
- container name
- Prev by Date: Re: Programmatic Forms Authentication
- Next by Date: Single sign-on question
- Previous by thread: container name
- Next by thread: Single sign-on question
- Index(es):
Relevant Pages
|
|