Programmatically Install Certificate into Mozilla

后端 未结 8 2140
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 20:28

Is there a way to programmatically install a certificate into mozilla? We\'re trying to script everything to eliminate deviations in environment so installing it by hand thr

8条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 21:08

    On Windows 7 with Firefox 10, the cert8.db file is stored at %userprofile%\AppData\Roaming\Mozilla\Firefox\Profiles\########.default\cert8.db. If you are an administrator, you can probably write a simple WMI application to copy the file to the User's respective folder.

    Also, a solution that worked for me from http://www.appdeploy.com/messageboards/tm.asp?m=52532&mpage=1&key=촴

    1. Copied CERTUTIL.EXE from the NSS zip file ( http://www.mozilla.org/projects/security/pki/nss/tools/ ) to C:\Temp\CertImport (I also placed the certificates I want to import there)

    2. Copied all the dll's from the NSS zip file to C\:Windows\System32

    3. Created a BAT file in %Appdata%\mozilla\firefox\profiles with this script...

      Set FFProfdir=%Appdata%\mozilla\firefox\profiles 
      Set CERTDIR=C:\Temp\CertImport 
      DIR /A:D /B > "%Temp%\FFProfile.txt" 
      FOR /F "tokens=*" %%i in (%Temp%\FFProfile.txt) do ( 
      CD /d "%FFProfDir%\%%i" 
      COPY cert8.db cert8.db.orig /y 
      For %%x in ("%CertDir%\Cert1.crt") do "%Certdir%\certutil.exe" -A -n "Cert1" -i "%%x" -t "TCu,TCu,TCu" -d . 
      For %%x in ("%CertDir%\Cert2.crt") do "%Certdir%\certutil.exe" -A -n "Cert2" -i "%%x" -t "TCu,TCu,TCu" -d . 
      ) 
      DEL /f /q "%Temp%\FFProfile.txt" 
      
    4. Executed the BAT file with good results.

提交回复
热议问题