Struct recrypt::api::Api [−]
pub struct Api<H, S, R> { /* fields omitted */ }
Recrypt public API
Methods
impl Api<Sha256, Ed25519, RandomBytes<ThreadRng>>
impl Api<Sha256, Ed25519, RandomBytes<ThreadRng>>
impl<CR: CryptoRng + RngCore> Api<Sha256, Ed25519, RandomBytes<CR>>
impl<CR: CryptoRng + RngCore> Api<Sha256, Ed25519, RandomBytes<CR>>
pub fn new_with_rand(r: CR) -> Api<Sha256, Ed25519, RandomBytes<CR>>
pub fn new_with_rand(r: CR) -> Api<Sha256, Ed25519, RandomBytes<CR>>
Trait Implementations
impl<H: Debug, S: Debug, R: Debug> Debug for Api<H, S, R>
impl<H: Debug, S: Debug, R: Debug> Debug for Api<H, S, R>
impl<H: Sha256Hashing, S, CR: RngCore + CryptoRng> SchnorrOps for Api<H, S, RandomBytes<CR>>
impl<H: Sha256Hashing, S, CR: RngCore + CryptoRng> SchnorrOps for Api<H, S, RandomBytes<CR>>
fn schnorr_sign<A: Hashable>(
&mut self,
priv_key: &PrivateKey,
pub_key: PublicKey,
message: &A
) -> SchnorrSignature
fn schnorr_sign<A: Hashable>(
&mut self,
priv_key: &PrivateKey,
pub_key: PublicKey,
message: &A
) -> SchnorrSignature
Create a signature for the message using priv_key
. - priv_key
- The private key which is used to generate the signature. - pub_key
the public key which will be used to validate the signature. - message
the message to sign. 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
. - pub_key
- The pub_key that was used in the signing process. - augmenting_priv_key
- If the pub_key
was augmented, pass the private key that was used to augment. None if no augmentation was done. - message
- Message that was signed. - signature
- The signature that was generated from schnorr_sign
. Read more
impl<H, S, CR: RngCore + CryptoRng> Ed25519Ops for Api<H, S, RandomBytes<CR>>
impl<H, S, CR: RngCore + CryptoRng> Ed25519Ops for Api<H, S, RandomBytes<CR>>
fn generate_ed25519_key_pair(&mut self) -> (PrivateSigningKey, PublicSigningKey)
fn generate_ed25519_key_pair(&mut self) -> (PrivateSigningKey, PublicSigningKey)
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 Api<H, S, R>
impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> KeyGenOps for Api<H, S, R>
fn compute_public_key(
&self,
private_key: &PrivateKey
) -> Result<PublicKey, ApiErr>
fn compute_public_key(
&self,
private_key: &PrivateKey
) -> Result<PublicKey, ApiErr>
Compute a PublicKey
given a PrivateKey
fn random_private_key(&mut self) -> PrivateKey
fn random_private_key(&mut self) -> PrivateKey
Generate a random private key. Read more
fn generate_key_pair(&mut self) -> Result<(PrivateKey, PublicKey), ApiErr>
fn generate_key_pair(&mut self) -> Result<(PrivateKey, PublicKey), ApiErr>
Generate a public/private keypair. Read more
fn generate_transform_key(
&mut self,
from_private_key: &PrivateKey,
to_public_key: PublicKey,
public_signing_key: PublicSigningKey,
private_signing_key: &PrivateSigningKey
) -> Result<TransformKey, ApiErr>
fn generate_transform_key(
&mut self,
from_private_key: &PrivateKey,
to_public_key: PublicKey,
public_signing_key: PublicSigningKey,
private_signing_key: &PrivateSigningKey
) -> Result<TransformKey, ApiErr>
Generate a transform key which is used to delegate to the to_public_key
from the from_private_key
. Read more
impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> CryptoOps for Api<H, S, R>
impl<R: RandomBytesGen, H: Sha256Hashing, S: Ed25519Signing> CryptoOps for Api<H, S, R>
fn gen_plaintext(&mut self) -> Plaintext
fn gen_plaintext(&mut self) -> Plaintext
Using the random_bytes, generate a random element of G_T, which is one of the rth roots of unity in FP12.
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.
fn encrypt(
&mut self,
plaintext: &Plaintext,
to_public_key: PublicKey,
public_signing_key: PublicSigningKey,
private_signing_key: &PrivateSigningKey
) -> Result<EncryptedValue, ApiErr>
fn encrypt(
&mut self,
plaintext: &Plaintext,
to_public_key: PublicKey,
public_signing_key: PublicSigningKey,
private_signing_key: &PrivateSigningKey
) -> Result<EncryptedValue, ApiErr>
Encrypt the plaintext to the to_public_key
. Read more
fn decrypt(
&self,
encrypted_value: EncryptedValue,
private_key: &PrivateKey
) -> Result<Plaintext, ApiErr>
fn decrypt(
&self,
encrypted_value: EncryptedValue,
private_key: &PrivateKey
) -> Result<Plaintext, ApiErr>
Decrypt the value using private_key
. Read more
fn transform(
&mut self,
encrypted_value: EncryptedValue,
transform_key: TransformKey,
public_signing_key: PublicSigningKey,
private_signing_key: &PrivateSigningKey
) -> Result<EncryptedValue, ApiErr>
fn transform(
&mut self,
encrypted_value: EncryptedValue,
transform_key: TransformKey,
public_signing_key: PublicSigningKey,
private_signing_key: &PrivateSigningKey
) -> Result<EncryptedValue, ApiErr>
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