Skip to main content

Avk

Struct Avk 

Source
pub struct Avk<H>
where H: Digest,
{ /* private fields */ }
Expand description

An ATMS aggregate key, Avk, contains a vector commitment of all eligible signers, and the aggregated key. Any third party with access to the public keys from all eligible signers can generate an aggregate key.

Let $\mathcal{VK} = \lbrace vk_i\rbrace_{i\in Es}$.

$$ avk = \left(\sum_{i\in Es}vk_i, \langle \mathcal{VK}\rangle\right) $$

In order to generate an Avk, it is necessary to previously produce a valid registration of all eligible signers. This guarantees that an Avk is only generated with keys with a valid proof of possession. Otherwise, an adversary could produce what is known as the “rogue key attack”.

Implementations§

Source§

impl<H> Avk<H>
where H: Digest + FixedOutput,

Source

pub fn check(&self, keys: &[PublicKeyPoP]) -> Result<(), AtmsError>

In order to verify the correctness of a key aggregation, one simply recomputes the aggregation for a given set, and checks that it matches the expected value.

§Error

The function returns AtmsError::InvalidPoP if one of the proofs of possession is invalid, and AtmsError::RegisterExistingKey if the input tuple contains a repeated key.

§Example
let n = 10; // nr of eligible signers
let threshold: usize = n - ((n - 1) / 3);
let mut rng = OsRng;

let mut keyspop: Vec<PublicKeyPoP> = Vec::with_capacity(n);
for _ in 0..n {
    let sk = SigningKey::gen(&mut rng);
    let pkpop = PublicKeyPoP::from(&sk);
    keyspop.push(pkpop);
}

let atms_registration = Registration::<Blake2b>::new(&keyspop)?;
assert!(atms_registration.to_avk().check(&keyspop).is_ok());
Source

pub fn to_bytes(&self) -> Vec<u8>

Convert Avk to byte string of size $48 + 8 + S$ where $S$ is the output size of the hash function.

§Layout

The layout of an Avk is

  • Aggregate key
  • Nr of parties
  • Merkle tree commitment
Source

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

Try to convert a byte string to an Avk. This function must be used in a setting where there exists a source of truth, and the verifier can check that the provided Avk is valid (e.g. through a signature of trusted authority).

§Error

Function fails if the byte representation corresponds to an invalid Avk

Trait Implementations§

Source§

impl<H> Debug for Avk<H>
where H: Digest + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<H: Digest> PartialEq for Avk<H>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<H: Digest> Eq for Avk<H>

Auto Trait Implementations§

§

impl<H> Freeze for Avk<H>

§

impl<H> RefUnwindSafe for Avk<H>
where H: RefUnwindSafe,

§

impl<H> Send for Avk<H>
where H: Send,

§

impl<H> Sync for Avk<H>
where H: Sync,

§

impl<H> Unpin for Avk<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for Avk<H>

§

impl<H> UnwindSafe for Avk<H>
where H: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.