Loading ePassport/ttcn/ePassport_Functions.ttcn +9 −0 Original line number Diff line number Diff line Loading @@ -348,25 +348,34 @@ // d) Generate keying material K.ICC. v_keyIcc := f_generateRandomOctetstring(c_bacKeySize); log("v_keyIcc: ", v_keyIcc); // e) Generate the concatenation R = RND.ICC || RND.IFD || K.ICC v_r := p_rndIcc & v_rndIfd & v_keyIcc; log("v_r: ", v_r); // f) Compute the cryptogram E_ICC = E[K_ENC](R). v_encryptedIcc := f_encrypt3Des(f_build3DesKey(vc_simu.kEnc), v_r); log("v_encryptedIcc: ", v_encryptedIcc); // g) Compute the checksum M_ICC = MAC[K_MAC](E_ICC). v_macIcc := f_cryptographicChecksum(vc_simu.kMac, v_encryptedIcc); log("v_macIcc: ", v_macIcc); // h) Send the response using the data E_ICC || M_ICC. v_respData := v_encryptedIcc & v_macIcc; log("v_respData: ", v_respData); // i) compute new K.SEED and derive keys v_kSeed := bit2oct(oct2bit(v_keyIfd) xor4b oct2bit(v_keyIcc)); log("v_kSeed: ", v_kSeed); f_deriveKeys(v_kSeed, vc_simu.kEnc, vc_simu.kMac); log("vc_simu.kEnc: ", vc_simu.kEnc); log("vc_simu.kMac: ", vc_simu.kMac); f_setKeysForSecureMessaging(vc_simu.kEnc & vc_simu.kMac); v_ssc := substr(p_rndIcc, 4, 4) & substr(v_rndIfd, 4, 4); log("v_ssc: ", v_ssc); f_setInitialSscForMessageAuthentication(v_ssc); return v_respData; Loading Loading
ePassport/ttcn/ePassport_Functions.ttcn +9 −0 Original line number Diff line number Diff line Loading @@ -348,25 +348,34 @@ // d) Generate keying material K.ICC. v_keyIcc := f_generateRandomOctetstring(c_bacKeySize); log("v_keyIcc: ", v_keyIcc); // e) Generate the concatenation R = RND.ICC || RND.IFD || K.ICC v_r := p_rndIcc & v_rndIfd & v_keyIcc; log("v_r: ", v_r); // f) Compute the cryptogram E_ICC = E[K_ENC](R). v_encryptedIcc := f_encrypt3Des(f_build3DesKey(vc_simu.kEnc), v_r); log("v_encryptedIcc: ", v_encryptedIcc); // g) Compute the checksum M_ICC = MAC[K_MAC](E_ICC). v_macIcc := f_cryptographicChecksum(vc_simu.kMac, v_encryptedIcc); log("v_macIcc: ", v_macIcc); // h) Send the response using the data E_ICC || M_ICC. v_respData := v_encryptedIcc & v_macIcc; log("v_respData: ", v_respData); // i) compute new K.SEED and derive keys v_kSeed := bit2oct(oct2bit(v_keyIfd) xor4b oct2bit(v_keyIcc)); log("v_kSeed: ", v_kSeed); f_deriveKeys(v_kSeed, vc_simu.kEnc, vc_simu.kMac); log("vc_simu.kEnc: ", vc_simu.kEnc); log("vc_simu.kMac: ", vc_simu.kMac); f_setKeysForSecureMessaging(vc_simu.kEnc & vc_simu.kMac); v_ssc := substr(p_rndIcc, 4, 4) & substr(v_rndIfd, 4, 4); log("v_ssc: ", v_ssc); f_setInitialSscForMessageAuthentication(v_ssc); return v_respData; Loading