pub struct SchmidtSamoaPublicKey { /* private fields */ }Expand description
Public key for the Schmidt-Samoa primitive.
Implementations§
Source§impl SchmidtSamoaPublicKey
impl SchmidtSamoaPublicKey
Sourcepub fn max_plaintext_exclusive(&self) -> BigUint
pub fn max_plaintext_exclusive(&self) -> BigUint
Return a conservative public upper bound for byte-oriented plaintexts.
For n = p^2 q, the private reduction modulus gamma = p q always
satisfies gamma > floor(sqrt(n)), so any message below this bound is
guaranteed to round-trip through the private map.
Sourcepub fn encrypt_raw(&self, message: &BigUint) -> BigUint
pub fn encrypt_raw(&self, message: &BigUint) -> BigUint
Apply the raw public map m^n mod n.
Unlike textbook RSA, the public exponent is the modulus n itself.
The inverse map recovers the original message only for values
interpreted in the range [0, gamma), where gamma = p q.
Sourcepub fn encrypt(&self, message: &[u8]) -> Option<BigUint>
pub fn encrypt(&self, message: &[u8]) -> Option<BigUint>
Encrypt a byte string using the conservative public plaintext bound.
Sourcepub fn encrypt_bytes(&self, message: &[u8]) -> Option<Vec<u8>>
pub fn encrypt_bytes(&self, message: &[u8]) -> Option<Vec<u8>>
Encrypt a byte string and return the serialized ciphertext bytes.
Sourcepub fn to_key_blob(&self) -> Vec<u8> ⓘ
pub fn to_key_blob(&self) -> Vec<u8> ⓘ
Encode the public 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 public key from the crate-defined binary format.
Trait Implementations§
Source§impl Clone for SchmidtSamoaPublicKey
impl Clone for SchmidtSamoaPublicKey
Source§fn clone(&self) -> SchmidtSamoaPublicKey
fn clone(&self) -> SchmidtSamoaPublicKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchmidtSamoaPublicKey
impl Debug for SchmidtSamoaPublicKey
Source§impl PartialEq for SchmidtSamoaPublicKey
impl PartialEq for SchmidtSamoaPublicKey
Source§fn eq(&self, other: &SchmidtSamoaPublicKey) -> bool
fn eq(&self, other: &SchmidtSamoaPublicKey) -> bool
self and other values to be equal, and is used by ==.