Struct ubiq::decryption::Decryption
source · pub struct Decryption<'a> { /* private fields */ }
Expand description
Structure encompassing parameters used for decrypting data
Using this structure, a caller is able to decrypt a ciphertext by feeding it to the member functions in a piecewise fashion (or by doing so all at once). In addition, if multiple, unique ciphertexts were encrypted with the same key, this object can be used to decrypt them without having to communicate with the server multiple times.
Implementations§
source§impl Decryption<'_>
impl Decryption<'_>
sourcepub fn new<'a>(creds: &Credentials) -> Result<Decryption<'a>>
pub fn new<'a>(creds: &Credentials) -> Result<Decryption<'a>>
Create a new decryption object
sourcepub fn begin(&mut self) -> Result<Vec<u8>>
pub fn begin(&mut self) -> Result<Vec<u8>>
Begin a new decryption “session”
Decryption of a ciphertext consists of a begin()
, some number
of update()
calls, and an end()
. It is an error to call
begin()
more than once without an intervening end()
.
sourcepub fn update(&mut self, ct: &[u8]) -> Result<Vec<u8>>
pub fn update(&mut self, ct: &[u8]) -> Result<Vec<u8>>
Input (some) ciphertext for decryption
The update function writes data into the Decryption object. Plaintext data may or may not be returned with each call to this function.
sourcepub fn end(&mut self) -> Result<Vec<u8>>
pub fn end(&mut self) -> Result<Vec<u8>>
End a decryption “session”
After all ciphertext has been written to the object via the
update()
function, the caller must call this function to finalize
the decryption. Any remaining plaintext will be returned. If the
algorithm in use is authenticated, an error may be returned instead
if the authentication process fails.
Note that if the algorithm in use is authenticated, any error in the authentication process will not be reported until this function is called. Therefore, when using an authenticated algorithm, output should not be trusted until this function returns successfully.