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-3.0.61 lib/utils/pkey_reader.rb
inspec-3.0.61 lib/utils/pkey_reader.rb
inspec-core-3.0.52 lib/utils/pkey_reader.rb
inspec-3.0.52 lib/utils/pkey_reader.rb
inspec-core-3.0.46 lib/utils/pkey_reader.rb
inspec-3.0.46 lib/utils/pkey_reader.rb
inspec-core-3.0.25 lib/utils/pkey_reader.rb
inspec-3.0.25 lib/utils/pkey_reader.rb
inspec-core-3.0.12 lib/utils/pkey_reader.rb
inspec-3.0.12 lib/utils/pkey_reader.rb
inspec-core-3.0.9 lib/utils/pkey_reader.rb
inspec-3.0.9 lib/utils/pkey_reader.rb
inspec-core-3.0.0 lib/utils/pkey_reader.rb
inspec-3.0.0 lib/utils/pkey_reader.rb
inspec-core-2.3.24 lib/utils/pkey_reader.rb
inspec-2.3.24 lib/utils/pkey_reader.rb
inspec-core-2.3.23 lib/utils/pkey_reader.rb
inspec-2.3.23 lib/utils/pkey_reader.rb
inspec-core-2.3.10 lib/utils/pkey_reader.rb
inspec-2.3.10 lib/utils/pkey_reader.rb