WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI LDAP CDO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get a User Certificate

 Keywords: Get a user certificate AD  user account Certificate Thumbprint LDAP userCertificate X509Certificates

; Get a user certificate.
strUserPath = "LDAP://shamrock/CN=Bob Smith,CN=Users,DC=jclass,DC=org"

; Get the certificate from a AD user account.
objLdap = GetObject("LDAP:")
objUser = objLdap.OpenDSObject(strUserPath, "shamrock\GuessWho","*TopSecret*", 1)
; Or the following when credentials not required.
;;; objUser = ObjectGet(strUserPath) 

; Get User certificate
aCert   = objUser.Get("userCertificate")  ; Returns a byte array.

; Get an instance of our Handy-dandy FCL class.
ObjectClrOption("use", "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
objCert2 =  ObjectClrNew( 'System.Security.Cryptography.X509Certificates.X509Certificate2' )

; Overloaded method accepts byte array as parameter.
objCert2.Import(aCert)
strThumb = objCert2.Thumbprint

Pause('Certificate Thumbprint', strThumb)

Article ID:   W18051
Filename:   Get a user certificate .txt
File Created: 2013:10:28:10:01:06
Last Updated: 2013:10:28:10:01:06