Is there a way to retrieve the certificate information such as issuer name, subject name, valid from and to date, etc. from the userCertificate property in the directory using either _vbscript_ or VB.Net? I can read the property and see the values; however, I'm unsure of how to deal with the x509 DER encoded information. I've tried the following code:
objMe = New DirectoryEntry("LDAP://cn=Waller\, David (Contractor),OU=Users,OU=xxxxx,DC=xx,DC=xxxx,DC=xxx")
MsgBox(objMe.Properties.Item("samAccountName").Value)
certStor = CByte(objMe.Properties.Item("userCertificate").Value)
objCert = New X509Certificate(certStor)
MsgBox(objMe.Properties.Item("samAccountName").Value)
certStor = CByte(objMe.Properties.Item("userCertificate").Value)
objCert = New X509Certificate(certStor)
However, I appear to be doing something wrong with the byte conversion when obtaining the property. Has anyone done this before, who can give me some guidance? I'd prefer to use _vbscript_ and CAPICOM; however, I'm more then willing to use the system.cryptography.x509certificates class if that's the way to do it. I haven't found much information available on the web or newsgroups.
Thanks,
Dave Waller
