Method: PKCS11::Library#initialize

Defined in:
lib/pkcs11/library.rb,
ext/pk11.c

#initialize(*args) ⇒ Library

Load and initialize a pkcs11 dynamic library.

If so_path is nil no library is loaded or initialized. In this case the calls to #load_library, #C_GetFunctionList and #C_Initialize have to be done manually, before using other methods:

pkcs11 = PKCS11::Library.new
pkcs11.load_library(so_path)
pkcs11.C_GetFunctionList
pkcs11.C_Initialize(args)

Note: When using RubyInstaller-2.4+ on Windows it might be required to add the path of dependent DLLs to the DLL search path. This can be done by the RUBY_DLL_PATH environment variable. See github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#user-content-dll-loading

Parameters:

  • so_path (String, nil)

    Path to the *.so or *.dll file to load.

  • args (Hash, CK_C_INITIALIZE_ARGS)

    A Hash or CK_C_INITIALIZE_ARGS instance with load params.


41
42
43
# File 'lib/pkcs11/library.rb', line 41

def initialize(so_path=nil, args={})
  unwrapped_initialize(so_path, args)
end