背景
使用ColdFusion 9(对等方未经过身份验证)使用Web服务时遇到一些问题。
首先,我要尝试importing the cert into ColdFusion's underlying Java keystore。如果这不起作用,我将尝试fiddle with ColdFusion's security provider。
但我的问题更具体......
问题:
如何在Chrome(或Linux CLI)中以及以哪种格式导出证书(在适当级别)?
详情
我已经看到了从浏览器导出证书的一些说明,但它们已经用于IE(旧版本,那个),我更喜欢使用Chrome,因为我在Linux上。
为了进入下面的屏幕截图,我:
从那里,我能够以四个级别中的一个出口:
哪一个合适?
此外,Adobe's documentation说“证书必须是Distinguished Encoding Rules(DER)格式的X.509证书。”,Chrome的导出对话框提供以下选项:
我认为“DER编码的二进制,单一证书”是否合适?
答案 0 :(得分:1)
以下生成了一个我可以使用keytool导入的证书:
对于后代,这是用于导入的命令:
sudo keytool -import -keystore /opt/jrun4/jre/lib/security/cacerts -alias "sb1.geolearning.com (Thawte SSL CA)" -storepass changeit -noprompt -trustcacerts -file ~/Downloads/sb1.geolearning.com
这是我现在正在做的事情(在Vagrant供应商中)。在这个脚本中,密钥库是硬编码的,因为我现在只将它用于Lucee;但是,密钥库可以很容易地参数化的路径。此外,runfile
相关代码就是这样,Vagrant不会多次运行脚本;如果您没有将代码用作Vagrant配置器,那么这些行是多余的。
唯一真正区别于上述解决方案的是,它通过openssl s_client
获取证书(并使用sed
清除它),而不是通过浏览器手动执行此操作。
#!/usr/bin/env bash
set -e
description="Add cert to Lucee's keystore."
while :
do
case $1 in
--provisioned-dir=*)
provisioned_dir=${1#*=} # Delete everything up till "="
shift
;;
--runfile-name=*)
runfile_name=${1#*=} # Delete everything up till "="
shift
;;
--site-host-name=*)
site_host_name=${1#*=} # Delete everything up till "="
shift
;;
-*)
echo "WARN: Unknown option (ignored): $1" >&2
shift
;;
*) # no more options. Stop while loop
break
;;
esac
done
runfile="${provisioned_dir}/${runfile_name}"
if [ -f "${runfile}" ]; then
echo "${description}: Already run."
exit 0
fi
echo "add cert to keystore"
echo -n | \
openssl s_client -connect ${site_host_name}:443 \
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
> /tmp/${site_host_name}.cert
/opt/lucee/jdk/jre/bin/keytool \
-import \
-keystore /opt/lucee/lib/lucee-server/context/security/cacerts \
-alias "${site_host_name} (self-signed)" \
-storepass changeit \
-file /tmp/${site_host_name}.cert \
-noprompt \
|| true
touch "${runfile}"