NIKE to KEM adapter: hashed ElGamal #
ENCAPSULATE(pk_static):
eph_sk, eph_pk := GEN_KEYPAIR(RNG)
ss := DH(eph_sk, pk_static)
ct := ENCODE_PUBKEY(eph_pk)
shared_key := KEYED(deriveKey(ss), ENCODE(pk_static) || ENCODE(eph_pk))
return ct, shared_key
DECAPSULATE(sk_static, ct):
eph_pk := DECODE_PUBKEY(ct)
ss := DH(sk_static, eph_pk)
shared_key := KEYED(deriveKey(ss), ENCODE(pub(sk_static)) || ENCODE(eph_pk))
return shared_key
The key is a PRF keyed by ss over the static key then the ephemeral key.
Encapsulation and decapsulation reject public keys that are not NIKE.Safe.
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Counter plus an inexhaustible seed stream.
Equations
Instances For
Equations
- Cryptlib.Primitives.KEM.Adapter.nextSeed (i, str) = EStateM.Result.ok (str i) (i + 1, str)
Instances For
Initial state over a caller-supplied seed stream, which must be unpredictable.
Equations
- Cryptlib.Primitives.KEM.Adapter.initWith str = (0, str)
Instances For
def
Cryptlib.Primitives.KEM.Adapter.derive
(F : PRF)
(nike : NIKE.NIKE.NIKE)
(ss : Vector UInt8 nike.sharedSecretSize)
(staticPk ephPk : Vector UInt8 nike.publicKeySize)
:
Vector UInt8 nike.sharedSecretSize
The shared key: the PRF over the static then ephemeral public key, at the NIKE's shared-secret width.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Cryptlib.Primitives.KEM.Adapter.encapM
(F : PRF)
(nike : NIKE.NIKE.NIKE)
(pk : nike.PublicKey)
:
EStateM KEM.KEMError St (nike.PublicKey × Vector UInt8 nike.sharedSecretSize)
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Cryptlib.Primitives.KEM.Adapter.decapM
(F : PRF)
(nike : NIKE.NIKE.NIKE)
(sk : nike.PrivateKey)
(ct : nike.PublicKey)
:
EStateM KEM.KEMError St (Vector UInt8 nike.sharedSecretSize)
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Cryptlib.Primitives.KEM.Adapter.encapM_consumes
(F : PRF)
(nike : NIKE.NIKE.NIKE)
(pk : nike.PublicKey)
(i : Nat)
(str : Nat → Bytes32)
:
theorem
Cryptlib.Primitives.KEM.Adapter.roundTrip
(F : PRF)
(nike : NIKE.NIKE.NIKE)
(sk : nike.PrivateKey)
(s : St)
:
Decapsulation recovers the encapsulated key for derivePublicKey sk. The True
hypothesis is kemOfNike's Reliable.
Equations
- One or more equations did not get rendered due to their size.