1

我正在尝试针对 ocsp 响应程序运行我的证书以检查其有效性。我正在使用 Ruby on rails 但基本上将其作为系统命令运行

目前,以下命令有效并将结果存储在文件中。

command = "openssl ocsp -issuer #{Rails.root}/ca-cert.crt -cert #{Rails.root}/"+@filename+".crt -CAfile #{Rails.root}/ca-cert.crt -url "+CONFIG[:ocsp_responder] +" > " + outputfile"
system(command)

但我不想传递“@filename.crt”,而是想传递 public_certificate 本身。什么是合适的语法?

我尝试了以下方法:

 command = "openssl ocsp -issuer #{Rails.root}/cert/ca-cert.crt -cert #{cert} -CAfile #{Rails.root}/data/certs/ca-cert.crt -url "+CONFIG[:ocsp_responder] +" > " + outputfile
# cert = the certificate in text --BEGIN..blah blah.--END

这不起作用。有没有无需指定公共证书文件的替代方法?

4

1 回答 1

0

老实说,我不相信命令行 openssl 客户端会以任何形式接受证书作为字符串,假设您想要执行以下操作:
cert = request.env['VAR_WITH_CERT]

您可能必须通过一些临时文件。

于 2015-11-01T17:49:56.663 回答