11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/omniauth-mpassid/test/certificate_generator.rb', line 11
def certificate
@certificate ||= begin
public_key = private_key.public_key
subject = '/C=FI/O=Test/OU=Test/CN=Test'
cert = OpenSSL::X509::Certificate.new
cert.subject = cert.issuer = OpenSSL::X509::Name.parse(subject)
cert.not_before = Time.now
cert.not_after = Time.now + 365 * 24 * 60 * 60
cert.public_key = public_key
cert.serial = 0x0
cert.version = 2
inject_certificate_extensions(cert)
cert.sign(private_key, OpenSSL::Digest::SHA1.new)
cert
end
end
|