Skip to content

Instantly share code, notes, and snippets.

@aschuch
Last active August 29, 2015 14:10
Show Gist options
  • Save aschuch/3896265c3a95f28dd531 to your computer and use it in GitHub Desktop.
Save aschuch/3896265c3a95f28dd531 to your computer and use it in GitHub Desktop.
@key = OpenSSL::PKey::RSA.new 2048
# Generate CSR
csr = OpenSSL::X509::Request.new
csr.version = 0
csr.subject = OpenSSL::X509::Name.new([
['CN', "PEM", OpenSSL::ASN1::UTF8STRING]
])
csr.public_key = @key.public_key
csr.sign @key, OpenSSL::Digest::SHA1.new
path = File.join(TMP_FOLDER, 'PEMCertificateSigningRequest.certSigningRequest')
open path, 'w' do |io|
io.write csr.to_pem
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment