Class: MooTool::Models::IMG4::IMG4Manifest
- Inherits:
-
Object
- Object
- MooTool::Models::IMG4::IMG4Manifest
- Includes:
- Helpers::IMG4
- Defined in:
- lib/mootool/models/img4/img4_manifest.rb
Overview
IMG4 Manifests are used in multiple ways, such as an APTicket which is a combined set of acceptable hashes, or as additional properties included in data such as FDR.
Constant Summary
Constants included from Helpers::IMG4
Helpers::IMG4::DECODE_TAGS, Helpers::IMG4::FIRMWARE_TAGS, Helpers::IMG4::HASH_LENGTHS, Helpers::IMG4::KEY_INSTANCE_TAGS, Helpers::IMG4::KVP_TAGS, Helpers::IMG4::OCTET_TAGS, Helpers::IMG4::SEQUENCE_TAGS, Helpers::IMG4::SIGNATURE_TAGS
Instance Attribute Summary collapse
-
#certificates ⇒ Object
readonly
Returns the value of attribute certificates.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
Instance Method Summary collapse
- #hashes ⇒ Object
-
#initialize(input) ⇒ IMG4Manifest
constructor
A new instance of IMG4Manifest.
- #inspect ⇒ Object
- #to_bytes ⇒ Object
- #to_h ⇒ Object
Methods included from Helpers::IMG4
#construct, #construct_object, #decode_construct, parse_4cc
Constructor Details
#initialize(input) ⇒ IMG4Manifest
Returns a new instance of IMG4Manifest.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 13 def initialize(input) @input = input @data = if @input.value.size == 1 input.value[0] else input end @version = @data.value[1].value.to_i @body = construct(@data.value[2]) @signature = File.parse_signature(@data.value[3]) if @data.value[3] @certificates = File.parse_certificates(@data.value[4]) if @data.value[4] end |
Instance Attribute Details
#certificates ⇒ Object (readonly)
Returns the value of attribute certificates.
11 12 13 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 11 def certificates @certificates end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
11 12 13 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 11 def signature @signature end |
Instance Method Details
#hashes ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 45 def hashes [ Models::Digest.create(::Digest::SHA384.digest(to_bytes)), Models::Digest.create(::Digest::SHA384.digest(@data.to_der)), Models::Digest.create(::Digest::SHA384.digest(@data.value[2].to_der)) ] end |
#inspect ⇒ Object
37 38 39 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 37 def inspect to_h.ai end |
#to_bytes ⇒ Object
41 42 43 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 41 def to_bytes @input.to_der end |
#to_h ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/mootool/models/img4/img4_manifest.rb', line 28 def to_h { version: @version, body: @body, signature: @signature, certificates: @certificates } end |