Class: Perkins::Build::Data::SshKey

Inherits:
Struct
  • Object
show all
Defined in:
lib/perkins/build/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#encodedObject

Returns the value of attribute encoded

Returns:

  • (Object)

    the current value of encoded



86
87
88
# File 'lib/perkins/build/data.rb', line 86

def encoded
  @encoded
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



86
87
88
# File 'lib/perkins/build/data.rb', line 86

def source
  @source
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



86
87
88
# File 'lib/perkins/build/data.rb', line 86

def value
  @value
end

Instance Method Details

#encoded?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/perkins/build/data.rb', line 95

def encoded?
  encoded
end

#fingerprintObject



99
100
101
102
103
# File 'lib/perkins/build/data.rb', line 99

def fingerprint
  rsa_key = OpenSSL::PKey::RSA.new(value)
  public_ssh_rsa = "\x00\x00\x00\x07ssh-rsa" + rsa_key.e.to_s(0) + rsa_key.n.to_s(0)
  OpenSSL::Digest::MD5.new(public_ssh_rsa).hexdigest.scan(/../).join(':')
end