Class: AndroidKeyAttestation::KeyDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/android_key_attestation/key_description.rb

Constant Summary collapse

ATTESTATION_VERSION_INDEX =
0
ATTESTATION_SECURITY_LEVEL_INDEX =
1
KEYMASTER_VERSION_INDEX =
2
KEYMASTER_SECURITY_LEVEL_INDEX =
3
ATTESTATION_CHALLENGE_INDEX =
4
UNIQUE_ID_INDEX =
5
SOFTWARE_ENFORCED_INDEX =
6
TEE_ENFORCED_INDEX =
7
SECURITY_LEVEL_ENUM =
{
  0 => :software,
  1 => :trusted_environment,
  2 => :strong_box
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(sequence) ⇒ KeyDescription

Returns a new instance of KeyDescription.



23
24
25
# File 'lib/android_key_attestation/key_description.rb', line 23

def initialize(sequence)
  @sequence = sequence
end

Instance Method Details

#attestation_challengeObject



43
44
45
# File 'lib/android_key_attestation/key_description.rb', line 43

def attestation_challenge
  sequence[ATTESTATION_CHALLENGE_INDEX].value
end

#attestation_security_levelObject



31
32
33
# File 'lib/android_key_attestation/key_description.rb', line 31

def attestation_security_level
  SECURITY_LEVEL_ENUM.fetch(Integer(sequence[ATTESTATION_SECURITY_LEVEL_INDEX].value))
end

#attestation_versionObject



27
28
29
# File 'lib/android_key_attestation/key_description.rb', line 27

def attestation_version
  Integer(sequence[ATTESTATION_VERSION_INDEX].value)
end

#keymaster_security_levelObject



39
40
41
# File 'lib/android_key_attestation/key_description.rb', line 39

def keymaster_security_level
  SECURITY_LEVEL_ENUM.fetch(Integer(sequence[KEYMASTER_SECURITY_LEVEL_INDEX].value))
end

#keymaster_versionObject



35
36
37
# File 'lib/android_key_attestation/key_description.rb', line 35

def keymaster_version
  Integer(sequence[KEYMASTER_VERSION_INDEX].value)
end

#software_enforcedObject



55
56
57
# File 'lib/android_key_attestation/key_description.rb', line 55

def software_enforced
  @software_enforced ||= AuthorizationList.new(sequence[SOFTWARE_ENFORCED_INDEX].value)
end

#tee_enforcedObject



51
52
53
# File 'lib/android_key_attestation/key_description.rb', line 51

def tee_enforced
  @tee_enforced ||= AuthorizationList.new(sequence[TEE_ENFORCED_INDEX].value)
end

#unique_idObject



47
48
49
# File 'lib/android_key_attestation/key_description.rb', line 47

def unique_id
  sequence[UNIQUE_ID_INDEX].value
end