Sha256: eef5950c3b21879cd516f261df6e22837823179d8c1113d26d22ea2541fca180

Contents?: true

Size: 999 Bytes

Versions: 2

Compression:

Stored size: 999 Bytes

Contents

#!/usr/bin/ruby
require 'rubygems'
require 'r509'
require 'r509/version'
require 'openssl'

if ARGV[0].nil? then
    puts "CSR and certificate parsing using r509 v#{R509::VERSION}."
    puts "Usage: r509-parse <cert or csr>"
else
    begin
        csr = R509::Csr.load_from_file ARGV[0]
    rescue
    end
    if not csr.nil?
        puts "Subject: #{csr.subject}"
        puts "SAN Names: #{csr.san_names.join(" , ")}"
    else
        begin
            cert = R509::Cert.load_from_file ARGV[0]
        rescue
        end
        if not cert.nil?
            puts "Subject: #{cert.subject}"
            puts "Issuer: #{cert.issuer}"
            puts "SAN Names: #{cert.san_names.join(" , ")}"
            puts "Not Before: #{cert.not_before}"
            puts "Not After: #{cert.not_after}"
            puts "Serial (Hex): #{cert.serial.to_s(16).upcase}"
            puts "Serial (Decimal): #{cert.serial}"
        else
            puts "Failed to parse CSR or certificate"
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
r509-0.8.1 bin/r509-parse
r509-0.8 bin/r509-parse