Struct Recrypt480
pub struct Recrypt480<H, S, R> { /* private fields */ }Expand description
Recrypt public API - 480-bit
If you are looking better performance, you might consider the 256-bit API in api.rs
Implementations§
§impl Recrypt480<Sha256, Ed25519, RandomBytes<DefaultRng>>
impl Recrypt480<Sha256, Ed25519, RandomBytes<DefaultRng>>
pub fn new() -> Recrypt480<Sha256, Ed25519, RandomBytes<DefaultRng>>
pub fn new() -> Recrypt480<Sha256, Ed25519, RandomBytes<DefaultRng>>
Construct a new Recrypt480 with pre-selected CSPRNG implementation.
The RNG will periodically reseed itself from the system’s best entropy source.
§impl<CR: CryptoRng> Recrypt480<Sha256, Ed25519, RandomBytes<CR>>
impl<CR: CryptoRng> Recrypt480<Sha256, Ed25519, RandomBytes<CR>>
pub fn new_with_rand(r: CR) -> Recrypt480<Sha256, Ed25519, RandomBytes<CR>>
pub fn new_with_rand(r: CR) -> Recrypt480<Sha256, Ed25519, RandomBytes<CR>>
Construct a Recrypt480 with the given RNG. Unless you have specific needs using new() is recommended.
Trait Implementations§
§impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> CryptoOps for Recrypt480<H, S, R>
impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> CryptoOps for Recrypt480<H, S, R>
§fn gen_plaintext(&self) -> Plaintext
fn gen_plaintext(&self) -> Plaintext
Using the random_bytes, generate a random element of G_T, which is one of the rth roots of unity in FP12. Read more
§fn derive_symmetric_key(
&self,
decrypted_value: &Plaintext,
) -> DerivedSymmetricKey
fn derive_symmetric_key( &self, decrypted_value: &Plaintext, ) -> DerivedSymmetricKey
Convert our plaintext into a DecryptedSymmetricKey by hashing it.
Typically you either use
derive_private_key or derive_symmetric_key but not both.§fn derive_private_key(&self, plaintext: &Plaintext) -> PrivateKey
fn derive_private_key(&self, plaintext: &Plaintext) -> PrivateKey
Derive a private key for a plaintext by hashing it twice (with known leading bytes) and modding it by the prime.
Typically you either use
derive_private_key or derive_symmetric_key but not both.§fn encrypt(
&self,
plaintext: &Plaintext,
to_public_key: &PublicKey,
signing_keypair: &SigningKeypair,
) -> Result<EncryptedValue, RecryptErr>
fn encrypt( &self, plaintext: &Plaintext, to_public_key: &PublicKey, signing_keypair: &SigningKeypair, ) -> Result<EncryptedValue, RecryptErr>
Encrypt the plaintext to the
to_public_key. Read more§fn decrypt(
&self,
encrypted_value: EncryptedValue,
private_key: &PrivateKey,
) -> Result<Plaintext, RecryptErr>
fn decrypt( &self, encrypted_value: EncryptedValue, private_key: &PrivateKey, ) -> Result<Plaintext, RecryptErr>
Decrypt the value using
private_key. Read more§fn transform(
&self,
encrypted_value: EncryptedValue,
transform_key: TransformKey,
signing_keypair: &SigningKeypair,
) -> Result<EncryptedValue, RecryptErr>
fn transform( &self, encrypted_value: EncryptedValue, transform_key: TransformKey, signing_keypair: &SigningKeypair, ) -> Result<EncryptedValue, RecryptErr>
Transform the value
encrypted_value using the transform_key.
The returned value can be decrypted by the private key associated to the to_public_key in the transform_key. Read more§impl Default for Recrypt480<Sha256, Ed25519, RandomBytes<DefaultRng>>
impl Default for Recrypt480<Sha256, Ed25519, RandomBytes<DefaultRng>>
§impl<H, S, CR: CryptoRng> Ed25519Ops for Recrypt480<H, S, RandomBytes<CR>>
impl<H, S, CR: CryptoRng> Ed25519Ops for Recrypt480<H, S, RandomBytes<CR>>
§fn generate_ed25519_key_pair(&self) -> SigningKeypair
fn generate_ed25519_key_pair(&self) -> SigningKeypair
Generate a signing key pair for use with the Ed25519Signing trait using the random number generator
used to back the RandomBytes struct.
§impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> KeyGenOps for Recrypt480<H, S, R>
impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> KeyGenOps for Recrypt480<H, S, R>
§fn compute_public_key(
&self,
private_key: &PrivateKey,
) -> Result<PublicKey, RecryptErr>
fn compute_public_key( &self, private_key: &PrivateKey, ) -> Result<PublicKey, RecryptErr>
Compute a
PublicKey given a PrivateKey§fn random_private_key(&self) -> PrivateKey
fn random_private_key(&self) -> PrivateKey
Generate a random private key. Read more
§fn generate_key_pair(&self) -> Result<(PrivateKey, PublicKey), RecryptErr>
fn generate_key_pair(&self) -> Result<(PrivateKey, PublicKey), RecryptErr>
Generate a public/private keypair. Read more
§fn generate_transform_key(
&self,
from_private_key: &PrivateKey,
to_public_key: &PublicKey,
signing_keypair: &SigningKeypair,
) -> Result<TransformKey, RecryptErr>
fn generate_transform_key( &self, from_private_key: &PrivateKey, to_public_key: &PublicKey, signing_keypair: &SigningKeypair, ) -> Result<TransformKey, RecryptErr>
Generate a transform key which is used to delegate to the
to_public_key from the from_private_key. Read more§impl<H: Sha256Hashing, S, CR: CryptoRng> SchnorrOps for Recrypt480<H, S, RandomBytes<CR>>
impl<H: Sha256Hashing, S, CR: CryptoRng> SchnorrOps for Recrypt480<H, S, RandomBytes<CR>>
§fn schnorr_sign<A: Hashable>(
&self,
priv_key: &PrivateKey,
pub_key: &PublicKey,
message: &A,
) -> SchnorrSignature
fn schnorr_sign<A: Hashable>( &self, priv_key: &PrivateKey, pub_key: &PublicKey, message: &A, ) -> SchnorrSignature
Create a signature for the message using
priv_key. Read more§fn schnorr_verify<A: Hashable>(
&self,
pub_key: &PublicKey,
augmenting_priv_key: Option<&PrivateKey>,
message: &A,
signature: SchnorrSignature,
) -> bool
fn schnorr_verify<A: Hashable>( &self, pub_key: &PublicKey, augmenting_priv_key: Option<&PrivateKey>, message: &A, signature: SchnorrSignature, ) -> bool
Verify that the message was signed by the matching private key to
pub_key. Note that if pub_key was augmented
the private key used in the augmentation should be passed in as augmenting_priv_key. Read moreAuto Trait Implementations§
impl<H, S, R> Freeze for Recrypt480<H, S, R>
impl<H, S, R> RefUnwindSafe for Recrypt480<H, S, R>
impl<H, S, R> Send for Recrypt480<H, S, R>
impl<H, S, R> Sync for Recrypt480<H, S, R>
impl<H, S, R> Unpin for Recrypt480<H, S, R>
impl<H, S, R> UnsafeUnpin for Recrypt480<H, S, R>
impl<H, S, R> UnwindSafe for Recrypt480<H, S, R>
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
Source§impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
Source§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
Source§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
Called to initialize a place to a valid value, after it is set
to all-bits-zero. Read more