95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/azure/storage/common/core/utility.rb', line 95
def get_certificate(private_key_file)
rsa = OpenSSL::PKey.read File.read(private_key_file)
cert = OpenSSL::X509::Certificate.new
cert.version = 2
cert.serial = 0
name = OpenSSL::X509::Name.new([["CN", "Azure Management Certificate"]])
cert.subject = cert.issuer = name
cert.not_before = Time.now
cert.not_after = cert.not_before + (60 * 60 * 24 * 365)
cert.public_key = rsa.public_key
cert.sign(rsa, OpenSSL::Digest::SHA1.new)
cert
end
|