class ThumbPrint
Attributes
cert[RW]
der_thumb_print[R]
host[R]
http[R]
thumb_print[R]
x509_cert[R]
Public Class Methods
new(host)
click to toggle source
# File lib/VMwareWebService/thumb_print.rb, line 8 def initialize(host) $log.info "ThumbPrint.initialize(#{host})" if $log @host = host @cert = nil uri http_request end
Public Instance Methods
http_request()
click to toggle source
# File lib/VMwareWebService/thumb_print.rb, line 16 def http_request @http = Net::HTTP.new(@uri.host, @uri.port) @http.use_ssl = true @http.verify_mode = OpenSSL::SSL::VERIFY_NONE end
to_sha1()
click to toggle source
# File lib/VMwareWebService/thumb_print.rb, line 22 def to_sha1 @cert = to_cert if @cert.nil? $log.info "ThumbPrint.to_sha1 for host #{@host}" if $log raise "Invalid Certificate" if @cert.nil? @x509_cert = OpenSSL::X509::Certificate.new(@cert) @der_thumb_print = OpenSSL::Digest::SHA1.new(@x509_cert.to_der).to_s @thumb_print = @der_thumb_print.scan(/../).collect(&:upcase).join(":") $log.info "ThumbPrint.to_sha1 for host #{@host} is #{@thumb_print}" if $log @thumb_print end