Trait ibe::kem::IBKEM

source ·
pub trait IBKEM: Clone {
    type Pk: Compress;
    type Sk: Compress;
    type Usk: Compress;
    type Ct: Compress + Default;
    type Id: Copy + Default + Derive;

    const IDENTIFIER: &'static str;
    const PK_BYTES: usize;
    const SK_BYTES: usize;
    const USK_BYTES: usize;
    const CT_BYTES: usize;

    // Required methods
    fn setup<R: Rng + CryptoRng>(rng: &mut R) -> (Self::Pk, Self::Sk);
    fn extract_usk<R: Rng + CryptoRng>(
        pk: Option<&Self::Pk>,
        sk: &Self::Sk,
        id: &Self::Id,
        rng: &mut R
    ) -> Self::Usk;
    fn encaps<R: Rng + CryptoRng>(
        pk: &Self::Pk,
        id: &Self::Id,
        rng: &mut R
    ) -> (Self::Ct, SharedSecret);
    fn decaps(
        mpk: Option<&Self::Pk>,
        usk: &Self::Usk,
        ct: &Self::Ct
    ) -> Result<SharedSecret, Error>;
}
Expand description

Identity-based key encapsulation mechanism (IBKEM).

Required Associated Types§

source

type Pk: Compress

Master public key (Mpk).

source

type Sk: Compress

Master secret key (Msk).

source

type Usk: Compress

User secret key (Usk).

source

type Ct: Compress + Default

Ciphertext (Ct).

source

type Id: Copy + Default + Derive

Identity.

Required Associated Constants§

source

const IDENTIFIER: &'static str

Scheme identifier.

source

const PK_BYTES: usize

Size of the master public key in bytes.

source

const SK_BYTES: usize

Size of the master secret key in bytes.

source

const USK_BYTES: usize

Size of the user secret key in bytes.

source

const CT_BYTES: usize

Size of the ciphertext in bytes.

Required Methods§

source

fn setup<R: Rng + CryptoRng>(rng: &mut R) -> (Self::Pk, Self::Sk)

Creates a MSK, MPK pair.

source

fn extract_usk<R: Rng + CryptoRng>( pk: Option<&Self::Pk>, sk: &Self::Sk, id: &Self::Id, rng: &mut R ) -> Self::Usk

Extract a user secret key for an identity using the MSK.

Optionally requires the system’s public key.

source

fn encaps<R: Rng + CryptoRng>( pk: &Self::Pk, id: &Self::Id, rng: &mut R ) -> (Self::Ct, SharedSecret)

Encapsulate a shared secret using the master public key and an identity.

source

fn decaps( mpk: Option<&Self::Pk>, usk: &Self::Usk, ct: &Self::Ct ) -> Result<SharedSecret, Error>

Decrypt a ciphertext using a user secret key to retrieve the shared secret.

Optionally requires a public key to perform this operation.

For some schemes this operation can fail explicitly, e.g., when an illegitimate ciphertext is used as input.

Implementors§

source§

impl IBKEM for CGWFO

Available on crate feature cgwfo only.
source§

const IDENTIFIER: &'static str = "cgwfo"

§

type Pk = PublicKey

§

type Sk = SecretKey

§

type Usk = UserSecretKey

§

type Ct = CipherText

§

type Id = Identity

source§

const PK_BYTES: usize = 576usize

source§

const USK_BYTES: usize = 448usize

source§

const SK_BYTES: usize = 384usize

source§

const CT_BYTES: usize = 480usize

source§

impl IBKEM for CGWKV

Available on crate feature cgwkv only.
source§

const IDENTIFIER: &'static str = "cgwkv"

§

type Pk = PublicKey

§

type Sk = SecretKey

§

type Usk = UserSecretKey

§

type Ct = CipherText

§

type Id = Identity

source§

const PK_BYTES: usize = 672usize

source§

const SK_BYTES: usize = 512usize

source§

const USK_BYTES: usize = 576usize

source§

const CT_BYTES: usize = 224usize

source§

impl IBKEM for KV1

Available on crate feature kv1 only.
source§

const IDENTIFIER: &'static str = "kv1"

§

type Pk = PublicKey

§

type Sk = SecretKey

§

type Usk = UserSecretKey

§

type Ct = CipherText

§

type Id = Identity

source§

const PK_BYTES: usize = 25_056usize

source§

const SK_BYTES: usize = 48usize

source§

const USK_BYTES: usize = 192usize

source§

const CT_BYTES: usize = 144usize