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§
Required Associated Constants§
sourceconst IDENTIFIER: &'static str
const IDENTIFIER: &'static str
Scheme identifier.
Required Methods§
sourcefn extract_usk<R: Rng + CryptoRng>(
pk: Option<&Self::Pk>,
sk: &Self::Sk,
id: &Self::Id,
rng: &mut R
) -> Self::Usk
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.
sourcefn encaps<R: Rng + CryptoRng>(
pk: &Self::Pk,
id: &Self::Id,
rng: &mut R
) -> (Self::Ct, SharedSecret)
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.
sourcefn decaps(
mpk: Option<&Self::Pk>,
usk: &Self::Usk,
ct: &Self::Ct
) -> Result<SharedSecret, Error>
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.
impl IBKEM for CGWFO
Available on crate feature
cgwfo
only.const IDENTIFIER: &'static str = "cgwfo"
type Pk = PublicKey
type Sk = SecretKey
type Usk = UserSecretKey
type Ct = CipherText
type Id = Identity
const PK_BYTES: usize = 576usize
const USK_BYTES: usize = 448usize
const SK_BYTES: usize = 384usize
const CT_BYTES: usize = 480usize
source§impl IBKEM for CGWKV
Available on crate feature cgwkv
only.
impl IBKEM for CGWKV
Available on crate feature
cgwkv
only.const IDENTIFIER: &'static str = "cgwkv"
type Pk = PublicKey
type Sk = SecretKey
type Usk = UserSecretKey
type Ct = CipherText
type Id = Identity
const PK_BYTES: usize = 672usize
const SK_BYTES: usize = 512usize
const USK_BYTES: usize = 576usize
const CT_BYTES: usize = 224usize
source§impl IBKEM for KV1
Available on crate feature kv1
only.
impl IBKEM for KV1
Available on crate feature
kv1
only.