我正在尝试使用openSSL生成自签名证书,这是内部功能测试的一部分。目的是为每轮测试生成新的证书(短期证书)。
对于构建过程,我已经将自定义目标添加到了CMakeLists.txt中,如下所示:
add_custom_target(ca_rsa
COMMAND mkdir -p ${INSTALL_LOCATION}/security_context/ca/cert
COMMAND mkdir -p ${INSTALL_LOCATION}/security_context/ca/private
COMMAND ${OPENSSL} req -nodes -x509 -days 30 -text -sha256 -newkey
rsa:2048 -keyout ${INSTALL_LOCATION}/security_context/ca/private/rsa_key.pem
-out ${INSTALL_LOCATION}/security_context/ca/cert/rsa_cert.pem
-config ./openssl_rsa.cnf)
ca_rsa被添加为项目目标可执行文件的依赖项。
运行构建时,出现以下错误:
/bin/sh: req not found
recipe for target ca_rsa failed
我尝试单独运行命令,它运行正常。
编辑:
$ {OPENSSL}设置如下:
set(OPENSSL ${OPENSSL_INSTALL_LOCATION}/bin/openssl)