Re: .net certificate store access with P/Invoke and CAPICOM
andrew
Date: 05/01/03
- Previous message: Mart: "Re: .net certificate store access with P/Invoke and CAPICOM"
- Maybe in reply to: Mart: "Re: .net certificate store access with P/Invoke and CAPICOM"
- Next in thread: Michel Gallant \(MVP\): "Re: .net certificate store access with P/Invoke and CAPICOM"
- Reply: Michel Gallant \(MVP\): "Re: .net certificate store access with P/Invoke and CAPICOM"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 1 May 2003 16:05:20 +1000
"Michel Gallant (MVP)" <neutron@istar.ca> wrote in message
news:utFbfiPDDHA.33376@TK2MSFTNGP10.phx.gbl...
> Current releases of .net framework (1.0, 1.1) do not have support for
> directly accessing cryptoAPI certificate stores although future releases
> should have more comprehensive crypto-support.
> The following article demonstrates how to access certificate stores using:
> - CAPICOM 2 interop
> - P/Invoke on the cryptoAPI libraries
> http://pages.istar.ca/~neutron/CapiCert
>
> The article includes sample code showing simple searching of
> a system cert store for a substring in the SubjectName cert. field,
> and retrieving a certificate context handle which can be used
> to instantiate an X509Certificate object.
Michel,
Are you aware of the Microsoft.Web.Services.Security.X509 namespace in
contained in Microsofts Web Service Enhancements ? Checkout
http://msdn.microsoft.com/webservices/building/wse/default.aspx
You can easily enumerate a specified store and search for certificates using
any of the following methods:
FindCertificateByHash()
FindCertificateByKeyIdentifier()
FindCertificateBySubjectName()
FindCertificateBySubjectString()
You can easily enumerate the store by the following code:
using Microsoft.Web.Services.Security.X509;
X509CertificateStore store = new
X509CertificateStore(X509CertificateStore.StoreProvider.System,
X509CertificateStore.StoreLocation.CurrentUser, "Root");
try {
store.OpenRead();
foreach (X509Certificate certificate in store.Certificates)
MessageBox.Show(certificate.ToString(true);
} finally {
store.Close();
}
hth
andrew
- Previous message: Mart: "Re: .net certificate store access with P/Invoke and CAPICOM"
- Maybe in reply to: Mart: "Re: .net certificate store access with P/Invoke and CAPICOM"
- Next in thread: Michel Gallant \(MVP\): "Re: .net certificate store access with P/Invoke and CAPICOM"
- Reply: Michel Gallant \(MVP\): "Re: .net certificate store access with P/Invoke and CAPICOM"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|