# File lib/puppet/ssl/base.rb, line 57 57: def fingerprint(md = :MD5) 58: require 'openssl/digest' 59: 60: # ruby 1.8.x openssl digest constants are string 61: # but in 1.9.x they are symbols 62: mds = md.to_s.upcase 63: if OpenSSL::Digest.constants.include?(mds) 64: md = mds 65: elsif OpenSSL::Digest.constants.include?(mds.to_sym) 66: md = mds.to_sym 67: else 68: raise ArgumentError, "#{md} is not a valid digest algorithm for fingerprinting certificate #{name}" 69: end 70: 71: OpenSSL::Digest.const_get(md).hexdigest(content.to_der).scan(/../).join(':').upcase 72: end