storeSessionKeys static method

Future<void> storeSessionKeys(
  1. Map<IsoKeyType, IsoSessionKey> keys
)

Puts the keys a logon returned into the security module, each at the slot the host settings name. The keys are never readable again afterwards.

Implementation

static Future<void> storeSessionKeys(Map<IsoKeyType, IsoSessionKey> keys) async {
  final Map<IsoKeyType, int> slots = <IsoKeyType, int>{
    IsoKeyType.dpk: config.sessionKeyIndexSetting.dpkIndex,
    IsoKeyType.ppk: config.sessionKeyIndexSetting.ppkIndex,
    IsoKeyType.mpk: config.sessionKeyIndexSetting.mpkIndex,
  };

  for (final MapEntry<IsoKeyType, IsoSessionKey> key in keys.entries) {
    try {
      await securityModule.storeSessionKey(
        keyIndex: slots[key.key]!,
        ktmIndex: config.initKeySetting.ktmIndex,
        keyType: key.key,
        sessionKey: key.value.value,
        kvc: key.value.checkValue,
      );
    } catch (error) {
      throw UIsoException(UIsoErrorCode.securityModuleFailed, "could not load a session key into the terminal", error);
    }
  }
}