Module: Tem
- Defined in:
- lib/tem_ruby.rb,
lib/tem/auto_conf.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Abi, Admin, Apdus, Builders, CA, Cert, ECert, Firmware, Hive, Isa, Keys, SeClosures, Toolkit Classes: Assembler, Benchmarks, Key, SecExecError, SecPack, Session
Class Method Summary collapse
-
.auto_conf ⇒ Object
Automatically configures a TEM.
-
.auto_tem ⇒ Object
Creates a new session to a TEM, using an automatically-configured transport.
Class Method Details
.auto_conf ⇒ Object
Automatically configures a TEM.
In case of success, the $tem global variable is set to a Tem::Session that can be used to talk to some TEM. An exception will be raised if the session creation fails.
It is safe to call auto_conf multiple times. A single session will be open.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tem/auto_conf.rb', line 9 def self.auto_conf return @tem if defined?(@tem) and @tem @tem = auto_tem $tem = @tem class << @tem def disconnect Tem.instance_variable_set :@tem, nil $tem = nil super end end end |
.auto_tem ⇒ Object
Creates a new session to a TEM, using an automatically-configured transport. :call-seq:
Tem.auto_tem -> Tem::Session
In case of success, returns a Tem::Session that can be used to talk to some TEM. An exception will be raised if the session creation fails.
29 30 31 32 33 |
# File 'lib/tem/auto_conf.rb', line 29 def self.auto_tem transport = Smartcard::Iso.auto_transport raise 'No suitable ISO7816 smart-card was found' unless transport Tem::Session.new transport end |