Skip to content

Instantly share code, notes, and snippets.

@Hexa
Created June 27, 2013 13:56
Show Gist options
  • Select an option

  • Save Hexa/5876603 to your computer and use it in GitHub Desktop.

Select an option

Save Hexa/5876603 to your computer and use it in GitHub Desktop.
irb(main):001:0> RUBY_DESCRIPTION
=> "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]"
irb(main):002:0> require 'openssl'
=> true
irb(main):003:0> extension_factory = OpenSSL::X509::ExtensionFactory.new
=> #<OpenSSL::X509::ExtensionFactory:0x007f870098d800 @config=nil>
irb(main):004:0> extension_factory.create_ext('subjectAltName', "DNS:www.example.com").value
=> "DNS:www.example.com"
irb(main):005:0> extension_factory.create_ext('subjectAltName', "DNS:www\0.example.com").value
=> "DNS:www"
irb(main):001:0> RUBY_DESCRIPTION
=> "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]"
irb(main):002:0> require 'openssl'
=> true
irb(main):003:0> extension_factory = OpenSSL::X509::ExtensionFactory.new
=> #<OpenSSL::X509::ExtensionFactory:0x007ffc68a38da8 @config=nil>
irb(main):004:0> extension_factory.create_ext('subjectAltName', "DNS:www.example.com").value
=> "DNS:www.example.com"
irb(main):005:0> extension_factory.create_ext('subjectAltName', "DNS:www\0.example.com").value
=> "DNS:www"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment