File: certificate_authority.rake

package info (click to toggle)
ruby-certificate-authority 0.2.0~434c15cd-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 424 kB
  • sloc: ruby: 2,645; makefile: 6
file content (23 lines) | stat: -rw-r--r-- 543 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'certificate_authority'

namespace :certificate_authority do
  desc "Generate a quick self-signed cert"
  task :self_signed do
    
    cn = "http://localhost"
    cn = ENV['DOMAIN'] unless ENV['DOMAIN'].nil?
    
  	root = CertificateAuthority::Certificate.new
  	root.subject.common_name= cn
  	root.key_material.generate_key
  	root.signing_entity = true
  	root.valid?
  	root.sign!
  	
  	print "Your cert for #{cn}\n"
  	print root.to_pem
  	
  	print "Your private key\n"
  	print root.key_material.private_key.to_pem
  end
end