Module: Thales::Pse::Cli::HSM

Includes:
TR::CliUtils, TR::CondUtils, Thales::Pse::Cli
Defined in:
lib/thales/pse/hsm.rb

Instance Method Summary collapse

Methods included from Thales::Pse::Cli

#cli_exec, #logger

Instance Method Details

#default_admin_slotObject



65
66
67
68
69
70
# File 'lib/thales/pse/hsm.rb', line 65

def default_admin_slot
  if @defAdminSlot.nil?
    @defAdminSlot = Slot.new(1)
  end
  @defAdminSlot
end

#default_user_slotObject



58
59
60
61
62
63
# File 'lib/thales/pse/hsm.rb', line 58

def default_user_slot
  if @defUserSlot.nil?
    @defUserSlot = Slot.new(0)
  end
  @defUserSlot
end

#init_hsm(*args, &block) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/thales/pse/hsm.rb', line 31

def init_hsm(*args,&block)

  expect = [
    { matcher: "enter new Admin SO pin:", block_key: :admin_so_pin, timeout: 5 },
    { matcher: "confirm new Admin SO pin:", block_key: :admin_so_pin_confirm, timeout: 5 },
    { matcher: "enter new Administrator\'s pin:", block_key: :admin_pin, timeout: 5 },
    { matcher: "confirm new Administrator\'s pin:", block_key: :admin_pin_confirm, timeout: 5 }
  ]

  begin

    cli_exec("ctconf") do |ops|
      case ops
      when :expect_list
        expect
      else
        block.call(ops)
      end
    end

  rescue ExecutableNotFoundError
    raise Error, "Executable 'ctconf' not found from PATH. Please install the driver or add the executable to PATH"
  end


end