Trait schnorr_fun::adaptor::Adaptor[][src]

pub trait Adaptor {
    fn encryption_key_for(&self, decryption_key: &Scalar) -> Point;
#[must_use] fn verify_encrypted_signature(
        &self,
        verification_key: &Point<EvenY, impl Secrecy>,
        encryption_key: &Point<impl Normalized, impl Secrecy>,
        message: Slice<'_, impl Secrecy>,
        encrypted_signature: &EncryptedSignature<impl Secrecy>
    ) -> bool;
fn decrypt_signature(
        &self,
        decryption_key: Scalar<impl Secrecy>,
        encrypted_signature: EncryptedSignature<impl Secrecy>
    ) -> Signature;
fn recover_decryption_key(
        &self,
        encryption_key: &Point<impl Normalized, impl Secrecy>,
        encrypted_signature: &EncryptedSignature<impl Secrecy>,
        signature: &Signature<impl Secrecy>
    ) -> Option<Scalar>; }

Extension trait adding the algorithms for the adaptor signature scheme to instances of Schnorr.

Required methods

fn encryption_key_for(&self, decryption_key: &Scalar) -> Point[src]

Derives the public encryption key corresponding to a secret decryption key.

Example

let decryption_key = Scalar::random(&mut rand::thread_rng());
let encryption_key = schnorr.encryption_key_for(&decryption_key);

#[must_use]fn verify_encrypted_signature(
    &self,
    verification_key: &Point<EvenY, impl Secrecy>,
    encryption_key: &Point<impl Normalized, impl Secrecy>,
    message: Slice<'_, impl Secrecy>,
    encrypted_signature: &EncryptedSignature<impl Secrecy>
) -> bool
[src]

Verifies an encrypted signature is valid i.e. if it is decrypted it will yield a signature on message under verification_key.

See synopsis for usage.

fn decrypt_signature(
    &self,
    decryption_key: Scalar<impl Secrecy>,
    encrypted_signature: EncryptedSignature<impl Secrecy>
) -> Signature
[src]

Decrypts an encrypted signature yielding the signature.

There are two crucial things to understand when calling this:

  1. You should be certain that the encrypted signature is what you think it is by calling verify_encrypted_signature on it first.
  2. Once you give the decrypted signature to anyone who has seen encrypted_signature they will be able to learn decryption_key by calling recover_decryption_key.

See synopsis for an example

fn recover_decryption_key(
    &self,
    encryption_key: &Point<impl Normalized, impl Secrecy>,
    encrypted_signature: &EncryptedSignature<impl Secrecy>,
    signature: &Signature<impl Secrecy>
) -> Option<Scalar>
[src]

Recovers the decryption key given an encrypted signature and the signature that was decrypted from it.

If the signature was not the one decrypted from the encrypted_signature then this function returns None. If it returns Some(decryption_key), then signature is the unique signature obtained by decrypting encrypted_signature with the decryption_key corresponding to encryption_key. In other words, if you already know that encrypted_signature is valid you do not have to call Schnorr::verify on signature before calling this function because this function returning Some implies it.

See synopsis for an example

Loading content...

Implementors

impl<CH, NG, GT> Adaptor for Schnorr<CH, NG, GT> where
    CH: Digest<OutputSize = U32> + Clone
[src]

Loading content...