|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
load CAPICOM Certificate from X509CertificateDoes anyone know of a way to instantiate a CAPICOM Certificate object from a .NET X509Certificate certificate object ? There is some functionality I need for for a certificate (export to PFX) that I can't do in the .NET X509Certificate object, so I'll need to use CAPICOM for that. I have already got code written in .NET for the user to go and select a certificate from his certificate store. That code returns a X509Certificate object (the one the user selected). I want to avoid having to rewrite that code again in CAPICOM, so I thought that maybe there's a way to instantiate a CAPICOM certificate from a X509Certificate I tried to do a GetRawCertData to get a string and then importing it to the CAPICOM Certificate object with the Import method and apparently it works, but the PrivateKey attribute of the created CAPICOM Certificate object throws an Exception (COM Exception, I think). Any ideas on this ? Or should I start rewriting code for the user certificate selection using CAPICOM instead of .net managed code ? Cheers, jm Hi Joao,
unfortunately I can't help you. I'm still trying to implement certificate selection from the store. Where did you find the code for doing this? THanks, Kind regards, Claudio Show quoteHide quote "Joao Maia" wrote: > Hi there, > > Does anyone know of a way to instantiate a CAPICOM Certificate object > from a .NET X509Certificate certificate object ? There is some > functionality I need for for a certificate (export to PFX) that I can't > do in the .NET X509Certificate object, so I'll need to use CAPICOM for > that. > > I have already got code written in .NET for the user to go and select a > certificate from his certificate store. That code returns a > X509Certificate object (the one the user selected). I want to avoid > having to rewrite that code again in CAPICOM, so I thought that maybe > there's a way to instantiate a CAPICOM certificate from a > X509Certificate > > I tried to do a GetRawCertData to get a string and then importing it to > the CAPICOM Certificate object with the Import method and apparently it > works, but the PrivateKey attribute of the created CAPICOM Certificate > object throws an Exception (COM Exception, I think). > > Any ideas on this ? Or should I start rewriting code for the user > certificate selection using CAPICOM instead of .net managed code ? > > Cheers, > > jm > > Try creating a certificate using Certificate.Import method. You should
use the string returned by below call as parameter for the Import function: Convert.ToBase64String(X509Certificate2.GetRawCertData()) Regards, Sandeep
Problems accessing the ASPNETDB.MDF file
single sign on from web to smart client Add Publisher Name to Published VS2005 Project How to programmingly check off "Allow inheritable permissions from Huge problem consuming .net event in JScript code Access Private Key File From X509 Certificate Can SslStream be set to ignore invalid certificates? Web Service, Authentication, Security & Domains authentication against adsi/ldap Cooecting to SQL server ?? |
|||||||||||||||||||||||