MCPcopy Create free account
hub / github.com/ElementsProject/lightning / decrypt_encrypted_data

Function decrypt_encrypted_data

common/blindedpath.c:200–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200struct tlv_encrypted_data_tlv *decrypt_encrypted_data(const tal_t *ctx,
201 const struct secret *ss,
202 const u8 *enctlv)
203{
204 const u8 *cursor = decrypt_encmsg_raw(tmpctx, ss, enctlv);
205 size_t maxlen = tal_bytelen(cursor);
206
207 /* BOLT #4:
208 * - If the `encrypted_recipient_data` field is missing, cannot be
209 * decrypted into an `encrypted_data_tlv` or contains unknown even
210 * fields:
211 * - MUST return an error
212 */
213 /* Note: our parser consider nothing is a valid TLV, but decrypt_encmsg_raw
214 * returns NULL if it couldn't decrypt. */
215 if (!cursor)
216 return NULL;
217 return fromwire_tlv_encrypted_data_tlv(ctx, &cursor, &maxlen);
218}
219
220bool blindedpath_get_alias(const struct secret *ss,
221 const struct pubkey *my_id,

Callers 3

decrypt_final_onionmsgFunction · 0.70
onion_decodeFunction · 0.70

Calls 2

decrypt_encmsg_rawFunction · 0.85
tal_bytelenFunction · 0.85

Tested by

no test coverage detected