Guest User

Untitled

a guest
Jul 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. require 'openssl'
  2.  
  3. key = OpenSSL::PKey::DSA.generate 1024
  4. puts key.to_pem
  5.  
  6. cert = OpenSSL::X509::Certificate.new
  7. cert.version = 2
  8. cert.serial = 1
  9. cert.subject = OpenSSL::X509::Name.new [['CN', 'Test CA']]
  10. cert.issuer = cert.subject
  11. cert.not_before = Time.now
  12. cert.not_after = Time.now + 365 * 24 * 60 * 60
  13. cert.public_key = key.public_key
  14. cert.sign key, OpenSSL::Digest::DSS1.new
  15. puts cert.to_pem
Add Comment
Please, Sign In to add comment