
Using Charm Crypto Lib: ElGamal Encryption and ECDSA Scheme
Learn how to use Charm Crypto Lib for implementing the ElGamal Encryption and ECDSA Scheme efficiently. Explore key generation, encryption, decryption, and more on elliptic curves. Find detailed instructions and examples for secure cryptographic operations.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
How to Use Charm Crypto Lib Chao Liu; Haibin Zhang
Introduction ElGamal Encryption ECDSA Scheme
Introduction https://jhuisi.github.io/charm/ Easy to implement a scheme. More than 40 schemes are implemented.
ElGamal Encryption m Encrypt message ( , , ) G q g = ( , , , ) y sk x G g q pk Choose random Generate Alice Bob Alice Alice = x pk g Alice = y ( ) s c = 1 c 2 pk Compute Bob Alice Alice y g m Compute Bob ( , ) 1c c = s Compute 2 c '= 2 m Compute x c Alice Alice Bob 1 ( y x y ( ) ( ) m pk y c x 1 m y s ) m g y Bob Alice Bob = = = = = ' 2 Alice ) m m Correctness: x x x ( ( ) g g g c Alice Bob Alice Bob Alice Bob Alice https://en.wikipedia.org/wiki/ElGamal_encryption
Algorithm Key-Gen(): Input: a secure Elliptic Curve (EC) group, for example, prime192v1(NIST Approved curve). g x x g Output: , Alice's private key and public key . Alice Alice Encryt(): x g Alice Input: message m, Alice's public key . 1,c c Output: two ciphertexts . 2 Decrypt(): 1,c c Input: Alice's private key and the ciphertexts . Alice x 2 Output: m' (m=m') or
Import a curve Import a elliptic curve, for example, prime192v1, prime192v2 Key-Gen() ( , , ) G q g = sk x = x pk g Alice Alice Alice Alice https://jhuisi.github.io/charm/cryptographers.html
Encrypt() y Choose random Bob c = 1 s = y g pk ( Compute Bob y ) Compute Bob Alice m Encrypt message = c m s Compute 2
Decrypt() x c ) (1 c (1 Compute 2 Compute x ) c
ECDSA ECDSA: Elliptic Curve Digital Signature Algorithm. sk = x Generate = s = 1 w Compute = = x { , } pk g y g ( , , ) pk r s ( ) u H M w Compute k Choose random 1 = u r w Compute e = (M ) H Compute 2 = u u ( ) ( ) v g y Compute 1 2 Bob r = k Alice g Compute = Compute : ? Verify v r = + 1 ( ) s e x r k Compute = = = u u u ( ) ( ) H M w x H M w x r w ( ) ( ) ( ) ( ) ( ) ( ) v g y g g g g Correctness: 1 2 2 k + ( ) e x r + = = = = ( ( ) ) H M x r w k + g g g r e x r
Algorithm Key-Gen(): Input: a secure Elliptic Curve (EC) group. x { } g g x Output: g, Alice's private key and public key . Sign(): x Input: message m, Alice's private key . r, s Output: signature . Verify(): x r, { } s g g Input: Alice's public key and the signature . Output: 1 or
Partial codes Key-Gen() sk = y = x x g Sign() Choose random Compute Compute k r = e = k g H (M ) = + 1 ( ) s e x r k Compute
Verify() = s = = 2 = 1 w u u v Compute Compute ( u ) H r g M w ) w 1 Compute Compute u ( ( ) y 1 2 = : ? Verify v r