Sha256: f5ff250a5a3f36e77eaa439d1f4b4a8b4901f1a14b545fa1e1dba22df6c02ade

Contents?: true

Size: 454 Bytes

Versions: 96

Compression:

Stored size: 454 Bytes

Contents

module PkeyReader
  def read_pkey(filecontent, passphrase)
    raise_if_default(passphrase)

    OpenSSL::PKey.read(filecontent, passphrase)
  rescue OpenSSL::PKey::PKeyError
    raise Inspec::Exceptions::ResourceFailed, 'passphrase error'
  end

  def raise_if_default(passphrase)
    if passphrase.is_a? Inspec::Attribute::DEFAULT_ATTRIBUTE
      raise Inspec::Exceptions::ResourceFailed, 'Please provide default value for attribute'
    end
  end
end

Version data entries

96 entries across 96 versions & 2 rubygems

Version Path
inspec-core-2.2.54 lib/utils/pkey_reader.rb
inspec-2.2.54 lib/utils/pkey_reader.rb
inspec-core-2.2.50 lib/utils/pkey_reader.rb
inspec-2.2.50 lib/utils/pkey_reader.rb
inspec-core-2.2.41 lib/utils/pkey_reader.rb
inspec-2.2.41 lib/utils/pkey_reader.rb
inspec-core-2.2.35 lib/utils/pkey_reader.rb
inspec-2.2.35 lib/utils/pkey_reader.rb
inspec-core-2.2.34 lib/utils/pkey_reader.rb
inspec-2.2.34 lib/utils/pkey_reader.rb
inspec-core-2.2.27 lib/utils/pkey_reader.rb
inspec-2.2.27 lib/utils/pkey_reader.rb
inspec-core-2.2.20 lib/utils/pkey_reader.rb
inspec-2.2.20 lib/utils/pkey_reader.rb
inspec-core-2.2.16 lib/utils/pkey_reader.rb
inspec-2.2.16 lib/utils/pkey_reader.rb
inspec-core-2.2.10 lib/utils/pkey_reader.rb
inspec-2.2.10 lib/utils/pkey_reader.rb
inspec-core-2.1.84 lib/utils/pkey_reader.rb
inspec-2.1.84 lib/utils/pkey_reader.rb