简体   繁体   中英

How to sign digital signature with python?

I am working with selenium to automate the website filling tasks. However, users can log in to the website only using the .p12 certificate by choosing. So when I press "log in with digital signature", it automatically opens the software that converts the .p12 file into XML and sends data to the website. Is it possible to do the same process completely in python without using any other external software/applications?

If you want try using Registry Editor and use ChromeDriver try:

1-) Press Windwos + R and type it "regedit".

2-) Rigth Click in "Computer\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies", select new -> Key and put the name "Google", then into this key add key "Chrome" and into this one add outher key called "AutoSelectCertificateForUrls". The full path need to be this "Computer\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Google\\Chrome\\AutoSelectCertificateForUrls".

3-) Rigth click on AutoSelectCertificateForUrls, new -> String Value, and put the name "1".

4-) Rigth click on "1", modified then copy and paste this JSON "{"pattern":"https://urlFromTheSiteYouWantAccess","filter":{"ISSUER":{"CN":"your cn"},"SUBJECT":{"CN":"your certificate cn"}}}".

I have answered in here other way to configure that with Group Policies and in my git you can find a exemple of how to edit the String Value with C#.

One word answer is No.

I suppose you are trying to do web scratching using selenium and want to automate login using Digital Certificate. Browsers run in system sandbox and can't access system resources without help of any other external software.

PKI Web Authentication using Digital Certificate and Browser Extension sample I have developed; also has native messaging host running under hood, which provides access to system Certificate Store (or Smartcard). Though, it can also handle the things silently without opening Certificate Selection pop-up, external component viz. Browser Extension and Native Host is required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM