Skip to main content

Hinting

Trait Hinting 

pub trait Hinting<K: KeyPair, L: ArraySize>: Sized {
    type HintSize: ArraySize;

    // Required methods
    fn new(
        blinded_public_key: &BlindedPublicKey<K>,
        message: &Array<u8, L>,
        context: &[u8],
        csprng: &mut impl CryptoRng,
    ) -> Result<Self, Error>;
    fn from_blinding_factor_secret(
        blinding_factor_secret: &K::SecretKey,
        blinded_public_key: &BlindedPublicKey<K>,
        message: &Array<u8, L>,
        context: &[u8],
    ) -> Result<Self, Error>;
    fn from_bytes(bytes: &[u8]) -> Result<Self, Error>;
    fn to_bytes(self) -> Array<u8, Self::HintSize>;
}
Expand description

Semi generic implementations to create new Hints

Required Associated Types§

type HintSize: ArraySize

Byte length of a serialized Hint: public key + ciphertext + tag.

Required Methods§

fn new( blinded_public_key: &BlindedPublicKey<K>, message: &Array<u8, L>, context: &[u8], csprng: &mut impl CryptoRng, ) -> Result<Self, Error>

Create a new Hint.

fn from_blinding_factor_secret( blinding_factor_secret: &K::SecretKey, blinded_public_key: &BlindedPublicKey<K>, message: &Array<u8, L>, context: &[u8], ) -> Result<Self, Error>

Create a new Hint using a blinding factor secret.

fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Deserialize from byte slice

§Security

Implementers must validate the deserialized blinded blinding factor and reject small-order and identity points with Error::InvalidPoint.

fn to_bytes(self) -> Array<u8, Self::HintSize>

Serialize to byte array

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<A: Aead + KeyInit, C: CurveArithmetic + PointCompression, L: ArraySize> Hinting<EllipticCurve<C>, L> for Hint<EllipticCurve<C>, A, L>

Available on crate feature rustcrypto-ec only.
§

type HintSize = <Hint<EllipticCurve<C>, A, L> as HintSized<EllipticCurve<C>, A, L>>::Size

§

impl<A: Aead + KeyInit, L: ArraySize> Hinting<DalekRistretto255, L> for Hint<DalekRistretto255, A, L>
where Self: HintSized<DalekRistretto255, A, L>,

§

impl<A: Aead + KeyInit, L: ArraySize> Hinting<DalekX25519, L> for Hint<DalekX25519, A, L>
where Self: HintSized<DalekX25519, A, L>,