Function hpke::VerifyPSKInputs
source · [−]pub fn VerifyPSKInputs(
config: HPKEConfig,
psk: &Psk,
psk_id: &PskId
) -> EmptyResult
Expand description
Creating the Encryption Context
…
def VerifyPSKInputs(mode, psk, psk_id):
got_psk = (psk != default_psk)
got_psk_id = (psk_id != default_psk_id)
if got_psk != got_psk_id:
raise Exception("Inconsistent PSK inputs")
if got_psk and (mode in [mode_base, mode_auth]):
raise Exception("PSK input provided when not needed")
if (not got_psk) and (mode in [mode_psk, mode_auth_psk]):
raise Exception("Missing required PSK input")
See KeySchedule
for detail.