Module: VacmanController

Defined in:
lib/vacman_controller.rb,
lib/vacman_controller/error.rb,
lib/vacman_controller/token.rb,
lib/vacman_controller/kernel.rb,
lib/vacman_controller/version.rb,
lib/vacman_controller/token/properties.rb,
ext/vacman_controller/main.c

Overview

Wraps VACMAN Controller functionality for Ruby.

Defined Under Namespace

Modules: Kernel, LowLevel Classes: Error, Token

Constant Summary collapse

VERSION =
'0.9.3'

Class Method Summary collapse

Class Method Details

.import(filename, key) ⇒ Object

Imports a .dpx file containing the token key material.

Parameters:

filename

The path of the .dpx file to load

key

The transport key to decrypt the dpx file

Returns:

An Array of Ruby Hashes. Each Hash contains the following keys:

serial:   the serial number of the token
blob:     the blob containing some secret magic data
app_name: the application name (the security method)
flags1:   flags
flags2:   flags

This is only for low-level usage. For a Ruby API, look at VacmanController::Token.import.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vacman_controller.rb', line 32

def import(filename, key)
  VacmanController::LowLevel.import(filename, key)

rescue VacmanController::Error => e
  # We handle two undocumented error codes here
  case e.error_code
  when -15
    raise VacmanController::Error, "#{e.library_method} error #{e.error_code}: invalid transport key"

  when -20
    raise VacmanController::Error, "#{e.library_method} error #{e.error_code}: cannot open DPX file"

  else
    raise # Sorry, I did my best.

  end
end

.kernelObject

Returns the Kernel module



52
53
54
# File 'lib/vacman_controller.rb', line 52

def kernel
  VacmanController::Kernel
end