Add global_platform shell command establish_scp02 and release_scp

Those commands can be used to establish and release a SCP02 secure
channel on the currently active logical channel.

The prompt is adjusted with a 'SCP02' prefix while the secure channel is
established.

Change-Id: Ib2f3c8f0563f81a941dd55b97c9836e3a6856407
This commit is contained in:
Harald Welte
2024-01-31 18:51:00 +01:00
parent 1e052f1efa
commit ca3678e471
4 changed files with 69 additions and 2 deletions

View File

@@ -108,6 +108,13 @@ class SCP02(SCP):
self.card_keys = card_keys
self.sk = None
self.mac_on_unmodified = False
self.security_level = None
def __str__(self) -> str:
if self.security_level:
return "%s[%02x]" % (self.__class__.__name__, self.security_level)
else:
return "%s[??]" % (self.__class__.__name__)
def _cla(self, sm: bool = False, b8: bool = True) -> int:
ret = 0x80 if b8 else 0x00