Module: Tem::Firmware::Uploader
- Defined in:
- lib/tem/firmware/uploader.rb
Overview
Installs and updates
Class Method Summary collapse
-
.applet_aid ⇒ Object
The AID for the firmware’s JavaCard applet.
-
.cap_file ⇒ Object
Path to the JavaCard CAP file containing the firmware.
-
.fw_version ⇒ Object
The firmware version in the JavaCard applet.
-
.upload_cap(transport) ⇒ Object
Uploads the firmware CAP file, removing any old version.
Class Method Details
.applet_aid ⇒ Object
The AID for the firmware’s JavaCard applet.
26 27 28 29 30 31 32 |
# File 'lib/tem/firmware/uploader.rb', line 26 def self.applet_aid # Cache expensive operation of unzipping the CAP file. return @applet_aid if @applet_aid cap_data = Smartcard::Gp::CapLoader.load_cap cap_file @applet_aid = Smartcard::Gp::CapLoader.parse_applets(cap_data).first[:aid] end |
.cap_file ⇒ Object
Path to the JavaCard CAP file containing the firmware.
CAP updates can be downloaded directly from the URL below. However, it’s recommended to obtain them by installing a new version of the tem_ruby gem. The gem is only tested with the firmware bundled with it.
Update URL: rubyforge.org/frs/?group_id=6431
20 21 22 |
# File 'lib/tem/firmware/uploader.rb', line 20 def self.cap_file File.join File.dirname(__FILE__), 'tc.cap' end |
.fw_version ⇒ Object
The firmware version in the JavaCard applet.
Returns a hash with the :major
and :minor
keys indicating the version numbers.
39 40 41 42 43 44 45 |
# File 'lib/tem/firmware/uploader.rb', line 39 def self.fw_version return @fw_version if @fw_version cap_data = Smartcard::Gp::CapLoader.load_cap cap_file @fw_version = Smartcard::Gp::CapLoader.parse_header(cap_data)[:package][:version] end |
.upload_cap(transport) ⇒ Object
Uploads the firmware CAP file, removing any old version.
Note that uploading a new version wipes the firmware’s data completely, so the TEM will have to be re-emitted, and will have a different endorsement key.
52 53 54 55 56 57 |
# File 'lib/tem/firmware/uploader.rb', line 52 def self.upload_cap(transport) class <<transport include Smartcard::Gp::GpCardMixin end transport.install_applet cap_file end |