Bonsoir
J'ai trouvé une méthode via l'objet CAPICOM. Cependant, ça marche bien jusqu'à IE8 exclu (mais à tester en vrai en fonction des différent OS)
J'ai fait les 2 config suivantes :
XP + IE6 : OK
Seven +IE8 : FAILED
J'ai adapté les scripts dispo sur :
http://www.jensign.com/JavaScience/www/wsh/index.html
J'ai laissé le nom de l'auteur en commentaire, car je n'ai qu'adapté et customisé ses exples.
Voici un script à exécuter depuis Scite (à case du conslewrite) qui liste les certifs en fonction du magasin choisi (MY = perso, CA, ROOT, ...) et affiche le subject.
► Afficher le texte
Code : Tout sélectionner
Dim $Store
Dim $Certificate
Dim $infotxt
Dim $storename, $Message, $Title
;~ '------ switch to display detailed cert dialog -----
Const $certdialog = True
;~ '-- Some typical cert store names in CurrentUserStore location ----
Const $mystore = "MY"
Const $friends = "AddressBook"
Const $trustroot = "ROOT"
Const $request = "REQUEST"
Const $castore = "CA"
Const $CAPICOM_PROPID_FRIENDLY_NAME = 11
Const $CAPICOM_ENCODE_ANY = -1
Const $CAPICOM_ENCODE_BASE64 = 0
Const $CAPICOM_ENCODE_BINARY = 1
Const $CAPICOM_STORE_OPEN_READ_ONLY = 0
Const $CAPICOM_STORE_OPEN_READ_WRITE = 1
Const $CAPICOM_CURRENT_USER_STORE = 2
;~ '--------------------------------------------------------
$Message = "Enter a certificate store name:"
$Title = "CertLister - by M. Gallant"
;~ '--- Prompt to get certificate store Name ---
$storename = InputBox($Title,$Message, "MY","", 300, 300)
;~ ' Evaluate the user input.
If $storename = "" Then
Exit 1
EndIf
$infotxt = "-- Certificates in " & $storename & " store: -----" & @CRLF & @CRLF
$Store = ObjCreate("CAPICOM.Store")
If $Store = 0 Then Exit 2
;'Store.Open 0, MY,0
;$Store.Open(2, $storename ,0) ;'open currentuser location for read-only
$Store.Open($CAPICOM_CURRENT_USER_STORE,$storename,$CAPICOM_STORE_OPEN_READ_ONLY) ;'open currentuser location for read-only
For $Certificate In $Store.Certificates
;If $certdialog Then $Certificate.Display
$infotxt = $infotxt & $Certificate.SubjectName & @CRLF & @CRLF
Next
$Store.Close
$Store = ""
ConsoleWrite($infotxt)
;'------ End CertLister script -------------------------
A partir de ce script je m'interesse non plus au subject, mais au sha1 du certificat, ainsi vous pourrez identifier à coups sûr le certif à supprimer.
Pour illustrer ceci, installer le certif bidon que je joint. Regarder au passage son empreinte numérique dans les propriétés, elle correspond au hash que j'ai codé en dur dans le programme : 0572015e2e3b6f41f672912ab058d97977b9f6cb
Localisez ce certif dans votre IE pour voir si il est bien installé dans les Racines connues.
Lancez le script suivant en laissant ROOT en magazin.
► Afficher le texte
Code : Tout sélectionner
Dim $Store
Dim $Certificate
Dim $infotxt
Dim $storename, $Message, $Title
Dim $hash_to_remove="0572015e2e3b6f41f672912ab058d97977b9f6cb"
;~ '------ switch to display detailed cert dialog -----
Const $certdialog = True
;~ '-- Some typical cert store names in CurrentUserStore location ----
Const $mystore = "MY"
Const $friends = "AddressBook"
Const $trustroot = "ROOT"
Const $request = "REQUEST"
Const $castore = "CA"
Const $CAPICOM_PROPID_FRIENDLY_NAME = 11
Const $CAPICOM_ENCODE_ANY = -1
Const $CAPICOM_ENCODE_BASE64 = 0
Const $CAPICOM_ENCODE_BINARY = 1
Const $CAPICOM_STORE_OPEN_READ_ONLY = 0
Const $CAPICOM_STORE_OPEN_READ_WRITE = 1
Const $CAPICOM_CURRENT_USER_STORE = 2
;~ '--------------------------------------------------------
$Message = "Enter a certificate store name:"
$Title = "CertLister - by M. Gallant"
;~ '--- Prompt to get certificate store Name ---
$storename = InputBox($Title,$Message, "ROOT","", 300, 300)
;~ ' Evaluate the user input.
If $storename = "" Then
Exit 1
EndIf
$infotxt = "-- Certificates in " & $storename & " store: -----" & @CRLF & @CRLF
$Store = ObjCreate("CAPICOM.Store")
If $Store = 0 Then Exit 2
;'Store.Open 0, MY,0
;$Store.Open(2, $storename ,0) ;'open currentuser location for read-only
$Store.Open($CAPICOM_CURRENT_USER_STORE,$storename,$CAPICOM_STORE_OPEN_READ_WRITE) ;'open currentuser location for read-write
For $Certificate In $Store.Certificates
;If $certdialog Then $Certificate.Display
;$infotxt = $infotxt & $Certificate.SubjectName & @CRLF & @CRLF
;ConsoleWrite($Certificate.SubjectName&" "&$Certificate.Thumbprint&@CRLF)
If $Certificate.Thumbprint=$hash_to_remove Then
$rep = MsgBox(52,"Attention","Voulez vous vraiment supprimer le certificat: "&@CRLF&$Certificate.SubjectName&" "&$Certificate.Thumbprint)
If $rep = 6 Then
$Store.Remove($Certificate)
EndIf
$infotxt = $infotxt & $Certificate.Thumbprint & @CRLF & @CRLF
EndIf
Next
$Store.Close
$Store = ""
ConsoleWrite($infotxt)
;'------ End CertLister script -------------------------
Au passage (si la conf OS/IE le permet ...) vous aurez un popup de confirmation supplémentaire déclenché nativement par l'action Remove.
Si ça ne marche pas ... J'ai vu qu'il existait dans les SDK de .Net une exe en ligne de commande certmgr.exe qui permettrait de faire la même chose.
Certif de test à sauvegarder en extension .crt :
► Afficher le texte
-----BEGIN CERTIFICATE-----
MIIFUDCCAzigAwIBAgIBATANBgkqhkiG9w0BAQUFADAwMQswCQYDVQQGEwJGUjEh
MB8GA1UEAwwYdGVzdF9zeWx2YW5pZV9mb3JfQVVUT0lUMB4XDTExMDIwMjE2MjEw
MFoXDTIxMDIwMjE2MjEwMFowMDELMAkGA1UEBhMCRlIxITAfBgNVBAMMGHRlc3Rf
c3lsdmFuaWVfZm9yX0FVVE9JVDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
ggIBANwSKphSAgDFNqtw5bfRRVXx7S17oMPFrE/8Qj1vpuBsmj7a/Y50NirO1X7Y
K3I/Eq80Vx3RGqjc9kGxD5ba4hzpO5tzNn8DyJK2T+adHobo/nP2RyqiCqje2HgV
DHr8rQxIjX536A12w8qVelPsWP3BQS9ywfaIGny96sX+XxTW8aJfkUQ1zRCB409T
f3s4YnuSaBV8Vy8n69+qfktNzmV76dlZpjtDDlqrNj980aOpa4hXLMeiIGmwkuoJ
uK5lhNd9KQNOWedxv5Y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O1sXA1UZkY8
akIajr1SpR7S+6bf8A4XkUaGLteUthp/sXGuFs75VeadNQ1Zc7chs3XEJsl8d42U
erKYBJuoxVse8e65yEJ6g9itTkQXc7B+qeQ6EkkeAsBJZtzFuj1fmcHuOmkkUrMa
gclTOYvhYIEf3qwN+RyoGe54tV+NfDiNAEczeE0b4PZwD2ImqDS+lO2ULvzBySFa
3qooihePvZSossk00kPOXJkInO4=
-----END CERTIFICATE-----
Bon courrage
Toi qui cherche à mettre le doigt sur la solution, appuie sur F1.