Chrome on Mac /OSX: Automatic Client Certificate selection while using Selenium

To avoid the browser prompt for certificate selection (which requires code outside of Selenium like autoIt/Sikuli)

1. Import the certificate to keyChain

Import the client certificate into keychain. Open the certificate detail –> Go to Trust section –> Select  “Always trust” for  “When using this certificate”

You can do this with command line utility as well:

security import   /<certDir>/certificate   -k  + ~/Library/Keychains/login.keychain  + ” -P ” + <password>;

2. To let Chrome automatically select the certificate automatically:

Create or Edit file “/Library/Preferences/com.google.Chrome.plist” :

<plist version=”1.0″>

<dict>

<key>AutoSelectCertificateForUrls</key>

<array>

<string>{“pattern”:”[*.]abhay.com”,”filter”:{“ISSUER”:{“CN”:”ABHAY_ISSUER”}}}</string>

</array>

</dict>

</plist>

–> with above content, a certificate issued from CA “ABHAY_ISSUER” will automatically get selected when user access <any>.abhay.com

Advertisement