Skip to main content

SecretSharing

Struct SecretSharing 

Source
pub struct SecretSharing;
Expand description

Распределённая генерация ключа и совместная расшифровка (GNUnet SECRETSHARING). Каждая операция — отдельное соединение с сервисом; drop Future отменяет её.

Implementations§

Source§

impl SecretSharing

Source

pub async fn generate( runtime: &GnunetRuntime, config: &Config, peers: &[PeerId], session_id: &HashCode, start: SystemTime, deadline: SystemTime, threshold: u32, ) -> Result<SharedSecret, SecretSharingError>

Создаёт сессию генерации ключа среди peers (GNUNET_SECRETSHARING_create_session) и ждёт её завершения. Все участники вызывают её с одинаковыми параметрами; threshold — сколько участников нужно для расшифровки.

Не передавайте в peers идентификатор локального peer, полученный от CORE или PILS: сервис 0.29.0 знает себя под другим идентификатором (ключ из файла без вывода PILS) и добавляет себя сам. С «чужим» для него собственным идентификатором генерация завершается пустой долей.

Source

pub async fn decrypt( runtime: &GnunetRuntime, config: &Config, share: &SecretShare, ciphertext: &SecretSharingCiphertext, start: SystemTime, deadline: SystemTime, ) -> Result<SecretSharingPlaintext, SecretSharingError>

Совместная расшифровка: участники, владеющие долями, публикуют частичные расшифровки (GNUNET_SECRETSHARING_decrypt). Результат — элемент группы, см. SecretSharingPlaintext::from_exponent.

Auto Trait Implementations§

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, 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.