Assignment - feedback Zdeněk Říha [USEMAP] Assignments l 1.Write a program (in any programming language) that will prepare a padded block for RSA signature with PKCS#1 v1.5 padding. Input is a file and RSA key size; output is the padded octet string (print it in hex). Use SHA-256 as the hash function. Do not use crypto library for the padding itself [5 points]. 2.Write a program that will generate 2048 bit DH parameters in DER format. Use any cryptolibrary and any programming language. Recommendation: Openssl & C & functions DH_new, DH_generate_parameters_ex, i2d_DHparams_bio. [5 points]. l [USEMAP] Assignment 1 lPKCS#1 v1.5 padding lWe open the PKCS#1 v2.2 document :-) lAlso available as RFC 8017 lWe find the relevant section l9.2 EMSA-PKCS1-v1_5 lEMSA-PKCS1-v1_5-ENCODE (M, emLen) lInput: Message + length of padded result (key size) lOutput: EM (the padded results) to be signed [USEMAP] Assignment 1 lAs we can see in step 5 the result is: l l lwhere PS is composed of 0xff bytes to fit the size land T is DER encoded structure containing the hash algorithm and hash itself: [USEMAP] Assignment 1 lThe authors of PKCS#1 are very nice and provide a help for common hash algorithms l l l l lwhere H is the hash (32 bytes for SHA-256) lPrint the EM in hex [USEMAP] Example - result l0001 fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffff 00 3031300d060960864801650304020105000420 7f5effba4da0fc825aa799e9bb3e4c50aec930e34f26e37f75a58fd3e26b0a38 [USEMAP] Example - python lSubmitted by Oldrich Florian [USEMAP] Assignment 2 lRead all PKCS#3 standard l8 pages including introduction, history, … lAssignment: lWrite a program that will generate 2048 bit DH parameters in DER format. l [USEMAP] Assignment 2 lProgramming language lUse any cryptolibrary and any programming language. lRecommendation: Openssl & C & functions DH_new, DH_generate_parameters_ex, i2d_DHparams_bio lTry “man dh” lVerify results: l“openssl asn1parse -inform DER -in yourfile.der” l“openssl dhparam -inform DER -in yourfile.der -noout -text” [USEMAP] Sample code in C lBased on submission of Roman Chrenst [USEMAP] Viewing the result [USEMAP]