Ruby openssl 生成证书
require 'openssl'key = OpenSSL::PKey::RSA.new(1024)digest = OpenSSL::Digest::SHA1.new()issu = sub = OpenSSL::X509::Name.new()sub.add_entry('O', 'Organization')sub.add_entry('OU', 'Project Implementation')sub.add_entry('CN', 'Ruby OpenSSL')cer = OpenSSL::X509::Certificate.new()cer.not_before = Time.at(0)cer.not_after = Time.at(0)cer.public_key = key # <= 接受签署的公匙 cer.serial = 1cer.issuer = issucer.subject = subcer.sign(key, digest) # <= 签署用的秘匙和哈希表函数print cer.to_text#补充:生成证书文件(Certificate.crt)File.open("Certificate","w")<<cer