Method: Keychain.open

Defined in:
lib/keychain.rb

.open(path) ⇒ Keychain::Keychain

Opens the keychain file at the specified path and adds it to the keychain search path ( SecKeychainOpen )

Will succeed even if the file doesn’t exists (however most operations on the keychain will then fail)

See developer.apple.com/library/mac/documentation/security/Reference/keychainservices/Reference/reference.html#//apple_ref/c/func/SecKeychainCopyDefault

Parameters:

  • path (String)

    Path to the keychain file

Returns:

Raises:

  • (ArgumentError)


61
62
63
64
65
66
67
# File 'lib/keychain.rb', line 61

def open(path)
  raise ArgumentError unless path
  out_buffer = FFI::MemoryPointer.new(:pointer)
  status = Sec.SecKeychainOpen(path,out_buffer);
  Sec.check_osstatus(status)
  Keychain.new(out_buffer.read_pointer).release_on_gc
end