Re: container name



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


.



Relevant Pages

  • Re: CAPICOM and key container
    ... For keys in a store we offer a strong key protection, ... protection for Local Machine keys is that only Administrators or users ACLd ... it's pretty easy to do with CAPICOM's Certificate object, ... > Now I have read that for storing a private key - a key container can be ...
    (microsoft.public.platformsdk.security)
  • Re: Active Directory Federation Services
    ... that is associated with their profile and the machine itself has a store. ... Just wanted to let you know that I got the cert problem fixed. ... the user certificate store. ... FSP was looking for certs in the local ...
    (microsoft.public.windows.server.active_directory)
  • Re: Accessing certificate store from ASP.NET web project
    ... the cert must be in the local computer/personal) store - it will then open ... Have a look at the source code to open the right cert store... ... One of the locations requires a x509 certificate in order ... different user context than my vb.net web project. ...
    (microsoft.public.dotnet.security)
  • Re: SMS 2003 SP1 Client Install Problem or Policy Retreival Problem?
    ... > Failed to find running shell process ... >> It is possible that the crypto store has somehow been corrupted. ... >>> The MP is setup and thousands of other clients have access. ... >>> Failed to find the certificate in the store, ...
    (microsoft.public.sms.admin)
  • Re: Issues with SSL on Win CE 5.0
    ... the HKCU certificate store. ... and tell the web server to use it. ... The old cert was in. ...
    (microsoft.public.windowsce.embedded)