Struct olm_rs::pk::OlmPkDecryption [−][src]
The decryption part of a PK encrypted channel.
Implementations
impl OlmPkDecryption[src]
pub fn new() -> Self[src]
Create a new PK decryption object initializing the private key to a random value.
Panics
NOT_ENOUGH_RANDOMif there's not enough random data provided when creating the OlmPkDecryption object.- on malformed UTF-8 coding of the public key that is generated by libolm.
pub fn pickle(&self, mode: PicklingMode) -> String[src]
Store a PkDecryption object.
Stores a PkDecryption object as a base64 string. Encrypts the object using the supplied passphrase. Returns a byte object containing the base64 encoded string of the pickled session.
Arguments
mode- The pickle mode that should be used to store the decryption object.
Panics
OUTPUT_BUFFER_TOO_SMALLfor OlmSession's pickled buffer- on malformed UTF-8 coding of the pickling provided by libolm
pub fn unpickle(
mut pickle: String,
mode: PicklingMode
) -> Result<Self, OlmPkDecryptionError>[src]
mut pickle: String,
mode: PicklingMode
) -> Result<Self, OlmPkDecryptionError>
Restore a previously stored OlmPkDecryption object.
Creates a OlmPkDecryption object from a pickled base64 string. Decrypts the pickled object using the supplied passphrase.
Arguments
mode- The pickle mode that should be used to store the decryption object.
C-API equivalent
olm_unpickle_pk_decryption
Errors
BadAccountKeyif the key doesn't match the one the account was encrypted withInvalidBase64if decoding the suppliedpickledstring slice fails
Panics
- on malformed UTF-8 coding of the public key that is generated by libolm.
pub fn decrypt(
&self,
mut message: PkMessage
) -> Result<String, OlmPkDecryptionError>[src]
&self,
mut message: PkMessage
) -> Result<String, OlmPkDecryptionError>
Decrypts a PK message using this decryption object.
Decoding is lossy, meaing if the decrypted plaintext contains invalid
UTF-8 symbols, they will be returned as U+FFFD (�).
Arguments
message- The encrypted PkMessage that should be decrypted.
C-API equivalent
olm_pk_decrypt
Errors
InvalidBase64on invalid base64 coding for supplied argumentsBadMessageVersionon unsupported protocol versionBadMessageFormaton failing to decode the messageBadMessageMacon invalid message MAC
Panics
OutputBufferTooSmallon plaintext output buffer
pub fn public_key(&self) -> &str[src]
Get the public key of the decryption object.
This can be used to initialize a encryption object to encrypt messages for this decryption object.
Trait Implementations
impl Default for OlmPkDecryption[src]
impl Drop for OlmPkDecryption[src]
impl Send for OlmPkDecryption[src]
Auto Trait Implementations
impl RefUnwindSafe for OlmPkDecryption[src]
impl !Sync for OlmPkDecryption[src]
impl Unpin for OlmPkDecryption[src]
impl UnwindSafe for OlmPkDecryption[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,