Class: Aws::EC2::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-resources/services/ec2/instance.rb

Instance Method Summary collapse

Instance Method Details

#decrypt_windows_password(key_pair_path) ⇒ String

Parameters:

  • key_pair_path (String, Pathname)

Returns:

  • (String)


9
10
11
12
13
14
# File 'lib/aws-sdk-resources/services/ec2/instance.rb', line 9

def decrypt_windows_password(key_pair_path)
  decoded = Base64.decode64(encrypted_password)
  pem_bytes = File.open(key_pair_path, 'rb') { |f| f.read }
  private_key = OpenSSL::PKey::RSA.new(pem_bytes)
  private_key.private_decrypt(decoded)
end