windows 在受信任的根证书存储上安装 SSL 证书的脚本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14052423/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 10:09:22  来源:igfitidea点击:

Script for Install SSL Certificate on Trusted Root Certificate Store

windowsbatch-filessl-certificate

提问by Kumar

I want to install self-signed certificate for IE, Firefox and Chrome in Windows (XP and 7).

我想在 Windows(XP 和 7)中为 IE、Firefox 和 Chrome 安装自签名证书。

I need to install certificate for several systems, So I planed to create .bat file that install certificate for browsers. I got following command while googled

我需要为多个系统安装证书,所以我打算创建一个为浏览器安装证书的 .bat 文件。我在谷歌搜索时收到了以下命令

certutil -addstore -f -enterprise -user root root_ca.cer

certutil -addstore -f -enterprise -user root root_ca.cer

But it only for IE. Is there any option for Chrome and Firefox.

但它仅适用于 IE。Chrome 和 Firefox 是否有任何选项。

回答by Katstevens

Bit of an old post but thought I would throw in my two cents anyway. You are right, that command in a batch script will install the certificate root_ca.cerinto the trusted CA store. I would modify the line to be:

有点旧的帖子,但我想无论如何我都会投入我的两美分。没错,批处理脚本中的该命令会将证书安装root_ca.cer到受信任的 CA 存储中。我会将该行修改为:

certutil -addstore -f -enterprise -user root "%~dp0root_ca.cer"

This way the shell will expand %~dp0to the path of the executing script so you can run it across a network from a UNC path and it will still work.

这样,shell 将扩展%~dp0到执行脚本的路径,因此您可以从 UNC 路径跨网络运行它,并且它仍然可以工作。

In answer to your other question, Chrome will (as of writing this post) read from the windows certificate store so there is no need to do anything special; just restart chrome after running the script and it should be sweet.

在回答您的另一个问题时,Chrome 将(在撰写本文时)从 Windows 证书存储中读取数据,因此无需执行任何特殊操作;运行脚本后只需重新启动chrome,它应该很甜蜜。

As for Mozilla check out this postfor a script to do that. Simples!

至于 Mozilla,请查看这篇文章以获取执行此操作的脚本。简单!