Class: Tem::Session
- Inherits:
-
Object
- Object
- Tem::Session
- Includes:
- Abi, Admin::Emit, Admin::Migrate, Apdus::Buffers, Apdus::Keys, Apdus::Lifecycle, Apdus::Tag, CA, ECert, SeClosures, Toolkit
- Defined in:
- lib/tem/tem.rb
Constant Summary collapse
- CAPPLET_AID =
[0x19, 0x83, 0x12, 0x29, 0x10, 0xBA, 0xBE]
Instance Attribute Summary collapse
-
#icache ⇒ Object
readonly
The TEM instance cache.
-
#transport ⇒ Object
readonly
The transport used for this TEM.
Instance Method Summary collapse
-
#clear_icache ⇒ Object
Clears the TEM instance cache.
- #disconnect ⇒ Object
-
#initialize(transport) ⇒ Session
constructor
A new instance of Session.
- #tem_secpack_error(response) ⇒ Object
Methods included from Toolkit
#tk_gen_key, #tk_post_key, #tk_read_key
Methods included from SeClosures
#execute, included, #sec_trace, #solve_psfault
Methods included from Tem::SeClosures::MixedMethods
Methods included from ECert
ecert_tag, ecert_tag_key, #endorsement_cert, #manufacturer_cert, #pubek
Methods included from CA
ca_cert, ca_key, config, new_ecert, scaffold_ca, scaffold_config
Methods included from Admin::Migrate
blank_ecert_verify_seclosure, blank_migrate_seclosure, blank_skey_load_seclosure, ecert_verify_bytes_tag_key, ecert_verify_seclosure, #migrate, migrate_bytes_tag_key, migrate_seclosure, seclosures_from_tag_data, skey_load_seclosure, skey_load_tag_key, tag_data
Methods included from Admin::Emit
emit, #emit, emit_keygen, emit_keygen_seclosure
Methods included from Apdus::Tag
decode_tag, encode_tag, #get_raw_tag_data, #get_raw_tag_length, #set_raw_tag_data, #set_tag, #tag
Methods included from Apdus::Lifecycle
Methods included from Apdus::Keys
#devchip_decrypt, #devchip_encrypt, #devchip_encrypt_decrypt, #devchip_generate_key_pair, #devchip_save_key, #release_key, #stat_keys
Methods included from Apdus::Buffers
#alloc_buffer, #flush_buffers, #get_buffer_length, #guess_buffer_chunk_size, #guess_buffer_chunk_size!, #post_buffer, #read_buffer, #release_buffer, #stat_buffers, #write_buffer
Methods included from Abi
Constructor Details
#initialize(transport) ⇒ Session
Returns a new instance of Session.
29 30 31 32 33 34 35 |
# File 'lib/tem/tem.rb', line 29 def initialize(transport) @transport = transport @transport.extend Smartcard::Gp::GpCardMixin @transport.select_application CAPPLET_AID @icache = {} end |
Instance Attribute Details
#icache ⇒ Object (readonly)
The TEM instance cache.
This cache stores information about the TEM connected to this session. The cache can be safely cleared without losing correctness.
The cache should not be modified directly by client code.
27 28 29 |
# File 'lib/tem/tem.rb', line 27 def icache @icache end |
#transport ⇒ Object (readonly)
The transport used for this TEM.
19 20 21 |
# File 'lib/tem/tem.rb', line 19 def transport @transport end |
Instance Method Details
#clear_icache ⇒ Object
Clears the TEM instance cache.
This should be called when connecting to a different TEM.
47 48 49 |
# File 'lib/tem/tem.rb', line 47 def clear_icache @icache.clear end |
#disconnect ⇒ Object
37 38 39 40 41 42 |
# File 'lib/tem/tem.rb', line 37 def disconnect return unless @transport @transport.disconnect @transport = nil clear_icache end |
#tem_secpack_error(response) ⇒ Object
51 52 53 |
# File 'lib/tem/tem.rb', line 51 def tem_secpack_error(response) raise "TEM refused the SECpack" end |