Class: AppInfo::Android::Signature::V2

Inherits:
Base
  • Object
show all
Includes:
Helper::Algorithm, Helper::IOBlock, Helper::Signatures
Defined in:
lib/app_info/android/signatures/v2.rb

Overview

Android v2 Signature

FULL FORMAT: OFFSET DATA TYPE DESCRIPTION

  • @+0 bytes uint32: signer size in bytes

  • @+4 bytes payload signer block

    • @+0 bytes unit32: signed data size in bytes

    • @+4 bytes payload signed data block

      • @+0 bytes unit32: digests with size in bytes

      • @+0 bytes unit32: digests with size in bytes

    • @+X bytes unit32: signatures with size in bytes

      • @+X+4 bytes payload signed data block

    • @+Y bytes unit32: public key with size in bytes

      • @+Y+4 bytes payload signed data block

Constant Summary collapse

BLOCK_ID =

V2 Signature ID 0x7109871a

[0x1a, 0x87, 0x09, 0x71].freeze

Constants included from Helper::Algorithm

Helper::Algorithm::SIG_DSA_WITH_SHA256, Helper::Algorithm::SIG_ECDSA_WITH_SHA256, Helper::Algorithm::SIG_ECDSA_WITH_SHA512, Helper::Algorithm::SIG_RSA_PKCS1_V1_5_WITH_SHA256, Helper::Algorithm::SIG_RSA_PKCS1_V1_5_WITH_SHA512, Helper::Algorithm::SIG_RSA_PSS_WITH_SHA256, Helper::Algorithm::SIG_RSA_PSS_WITH_SHA512, Helper::Algorithm::SIG_STRIPPING_PROTECTION_ATTR_ID, Helper::Algorithm::SIG_VERITY_DSA_WITH_SHA256, Helper::Algorithm::SIG_VERITY_ECDSA_WITH_SHA256, Helper::Algorithm::SIG_VERITY_RSA_PKCS1_V1_5_WITH_SHA256

Constants inherited from Base

Base::DESCRIPTION

Instance Attribute Summary collapse

Attributes inherited from Base

#verified

Instance Method Summary collapse

Methods included from Helper::Algorithm

#algorithem_priority, #algorithm_match, #algorithm_method, #best_algorithem, #compare_algorithem

Methods included from Helper::Signatures

#signature_algorithms, #signed_data_certs, #signed_data_digests, #singers_block, #verify_additional_attrs

Methods included from Helper::IOBlock

#left_bytes_check, #length_prefix_block, #loop_length_prefix_io

Methods inherited from Base

#description, #initialize, #logger, #scheme, verify

Constructor Details

This class inherits a constructor from AppInfo::Android::Signature::Base

Instance Attribute Details

#certificatesObject (readonly)

Returns the value of attribute certificates.



28
29
30
# File 'lib/app_info/android/signatures/v2.rb', line 28

def certificates
  @certificates
end

#digestsObject (readonly)

Returns the value of attribute digests.



28
29
30
# File 'lib/app_info/android/signatures/v2.rb', line 28

def digests
  @digests
end

Instance Method Details

#verifyObject

TODO:

verified signatures

Verify



36
37
38
39
40
# File 'lib/app_info/android/signatures/v2.rb', line 36

def verify
  signers_block = singers_block(BLOCK_ID)
  @certificates, @digests = verified_certs(signers_block, verify: true)
  # @verified = true
end

#versionObject



30
31
32
# File 'lib/app_info/android/signatures/v2.rb', line 30

def version
  Version::V2
end