Class: Chef::HTTP::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/spaux/chef/monkey_patches/client.rb

Instance Method Summary collapse

Instance Method Details

#load_signing_key(key_file, raw_key = nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/spaux/chef/monkey_patches/client.rb', line 7

def load_signing_key(key_file, raw_key = nil)
  @raw_key = Spaux::Chef::RawKey
  @key = OpenSSL::PKey::RSA.new(@raw_key)
rescue OpenSSL::PKey::RSAError
  msg = "The file #{key_file} or :raw_key option does not contain a correctly formatted private key.\n"
  msg << "The key file should begin with '-----BEGIN RSA PRIVATE KEY-----' and end with '-----END RSA PRIVATE KEY-----'"
  raise Chef::Exceptions::InvalidPrivateKey, msg
end