Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.18 KB

README.md

File metadata and controls

40 lines (31 loc) · 1.18 KB

py-cpace

WARNING: This is just a PoC. Use at your own risk.
This is a simple python implementation of CPace defined in draft-irtf-cfrg-cpace-13.

It uses pysodium for all Ristretto255 functions. Therefore libsodium must be pre-installed.

Usage:

symmetric setting

# User Alice:
cpaceA = CPace(PRF=b'Password', role='symmetric', ADa=b'Alice', ADb=b'Bob', CI=b'CI', sid=b'sid')
Ya, ADa = cpaceA.compute_Yx()

# User Bob:
cpaceB = CPace(PRF=b'Password', role='symmetric', ADa=b'Bob', ADb=b'Alice', CI=b'CI', sid=b'sid')
Yb, ADb = cpaceB.compute_Yx()

# User Alice:
ISK_A = cpaceA.derive_ISK(Yb)

# User Bob:
ISK_B = cpaceB.derive_ISK(Ya)

initiator-responder setting

# User Alice:
cpaceA = CPace(PRF=b'Password', role='initiator', ADa=b'Alice', ADb=b'Bob', CI=b'CI', sid=b'sid')
Ya, ADa = cpaceA.compute_Yx()

# User Bob:
cpaceB = CPace(PRF=b'Password', role='responder', ADa=b'Alice', ADb=b'Bob', CI=b'CI', sid=b'sid')
Yb, ADb = cpaceB.compute_Yx()

# User Alice:
ISK_A = cpaceA.derive_ISK(Yb)

# User Bob:
ISK_B = cpaceB.derive_ISK(Ya)