pub struct CocksPrivateKey { /* private fields */ }Expand description
Private key for the Cocks primitive.
Implementations§
Source§impl CocksPrivateKey
impl CocksPrivateKey
Sourcepub fn decrypt_raw(&self, ciphertext: &BigUint) -> BigUint
pub fn decrypt_raw(&self, ciphertext: &BigUint) -> BigUint
Decrypt the raw integer ciphertext.
The Python source recovers the message as c^pi mod q, so the original
message must be interpreted in the range [0, q).
Sourcepub fn decrypt(&self, ciphertext: &BigUint) -> Vec<u8> ⓘ
pub fn decrypt(&self, ciphertext: &BigUint) -> Vec<u8> ⓘ
Decrypt a ciphertext back into the big-endian byte string that was interpreted as the plaintext integer.
Sourcepub fn decrypt_bytes(&self, ciphertext: &[u8]) -> Option<Vec<u8>>
pub fn decrypt_bytes(&self, ciphertext: &[u8]) -> Option<Vec<u8>>
Decrypt a byte-encoded ciphertext produced by CocksPublicKey::encrypt_bytes.
Sourcepub fn to_key_blob(&self) -> Vec<u8> ⓘ
pub fn to_key_blob(&self) -> Vec<u8> ⓘ
Encode the private key in the crate-defined binary format.
Sourcepub fn from_key_blob(blob: &[u8]) -> Option<Self>
pub fn from_key_blob(blob: &[u8]) -> Option<Self>
Decode the private key from the crate-defined binary format.
Trait Implementations§
Source§impl Clone for CocksPrivateKey
impl Clone for CocksPrivateKey
Source§fn clone(&self) -> CocksPrivateKey
fn clone(&self) -> CocksPrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CocksPrivateKey
impl Debug for CocksPrivateKey
Source§impl PartialEq for CocksPrivateKey
impl PartialEq for CocksPrivateKey
Source§fn eq(&self, other: &CocksPrivateKey) -> bool
fn eq(&self, other: &CocksPrivateKey) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for CocksPrivateKey
impl StructuralPartialEq for CocksPrivateKey
Auto Trait Implementations§
impl Freeze for CocksPrivateKey
impl RefUnwindSafe for CocksPrivateKey
impl Send for CocksPrivateKey
impl Sync for CocksPrivateKey
impl Unpin for CocksPrivateKey
impl UnsafeUnpin for CocksPrivateKey
impl UnwindSafe for CocksPrivateKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more