MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / decrypt

Method decrypt

mlspp/src/crypto.cpp:328–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328bytes
329HPKEPrivateKey::decrypt(CipherSuite suite,
330 const std::string& label,
331 const bytes& context,
332 const HPKECiphertext& ct) const
333{
334 auto label_plus = mls_1_0_plus(label);
335 auto encrypt_context = tls::marshal(EncryptContext{ label_plus, context });
336 auto skR = suite.hpke().kem.deserialize_private(data);
337 auto ctx = suite.hpke().setup_base_r(ct.kem_output, *skR, encrypt_context);
338 auto pt = ctx.open({}, ct.ciphertext);
339 if (!pt) {
340 throw InvalidParameterError("HPKE decryption failure");
341 }
342
343 return opt::get(pt);
344}
345
346bytes
347HPKEPrivateKey::do_export(CipherSuite suite,

Callers 3

verifyMethod · 0.45
StateMethod · 0.45
decapMethod · 0.45

Calls 7

mls_1_0_plusFunction · 0.85
setup_base_rMethod · 0.80
marshalFunction · 0.50
getFunction · 0.50
deserialize_privateMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected