Skip to main content

decrypt_shielded_address

Function decrypt_shielded_address 

Source
pub fn decrypt_shielded_address(
    shared_key: &[u8; 32],
    field: &[u8],
) -> Result<[u8; 43], CryptoError>
Expand description

Decrypt a contact request’s encryptedShieldedAddress to the 43 bytes it carries.

A value of any length but 64 is refused, the 80 bytes the contract keeps for a later encoding included, and so is one whose plaintext is not exactly 43 bytes. CBC does not authenticate, so a value decrypted under the wrong key can still pass: the caller uses the result only if the same key decrypts the request’s encryptedPublicKey to a well-formed key and the bytes are a valid address that is neither its own nor the sender’s profile address.