# File lib/rhc/rest/key.rb, line 19 def destroy debug "Deleting key #{self.name}" rest_method "DELETE" end
# File lib/rhc/rest/key.rb, line 29 def fingerprint @fingerprint ||= begin public_key = Net::SSH::KeyFactory.load_data_public_key("#{type} #{content}") public_key.fingerprint rescue NotImplementedError, Net::SSH::Exception, OpenSSL::PKey::PKeyError 'Invalid key' end if is_ssh? end
# File lib/rhc/rest/key.rb, line 10 def is_kerberos? type == 'krb5-principal' end
# File lib/rhc/rest/key.rb, line 6 def is_ssh? type != 'krb5-principal' end
# File lib/rhc/rest/key.rb, line 25 def principal content if is_kerberos? end
# File lib/rhc/rest/key.rb, line 14 def update(type, content) debug "Updating key #{self.name}" rest_method "UPDATE", :type => type, :content => content end
# File lib/rhc/rest/key.rb, line 38 def visible_to_ssh? is_ssh? and Net::SSH::Authentication::Agent.connect.identities. find{ |i| fingerprint == i.fingerprint }.present? rescue false end