P:\CRCS\2012_0178_Redesign_loga_a_JVS\PPT_prezentace\sablona\pracovni\normalni.jpg titulka PV181 Laboratory of security and applied cryptography HW 01 Solution •Marek Sýs •syso@mail.muni.cz, A405 P:\CRCS\2012_0178_Redesign_loga_a_JVS\PPT_prezentace\sablona\pracovni\normalni.jpg Task 01 key generation and bitmanipulation •bits_used – number of generated bits •Which bit is the first not set: –byte_offset - index of byte in which is the bit) –bit_offset – position of bit in the given byte (byte_offset) –Example for (bit_offset =2 and rnd=01011… ): – – – • 2 I PA193 - Introductory info 01234567 00000000 01234567 01000000 01234567 00000000 01234567 00000000 01234567 00000000 --010111 10001100 11000111 11001001 10 10001100 11000111 11 001001 10000000 01011110 00110011 00011111 00100110 Shift by +2 Shift by -6 P:\CRCS\2012_0178_Redesign_loga_a_JVS\PPT_prezentace\sablona\pracovni\normalni.jpg Task 02 Key reconstruction •Encryption: –K = rand() | rand () | … but seeded with = time –E(K,pt) = ct • •Attack: –Entropy of the seed is 32 bits ! - easy to guess –For all seeds: •Generate key K’, encrypt E(K’,pt) = ct’ • If ct’ == ct return K’ – – – – • 3 I PA193 - Introductory info P:\CRCS\2012_0178_Redesign_loga_a_JVS\PPT_prezentace\sablona\pracovni\normalni.jpg Task 03 Secure encryption •Entire key has to be generated by dev/(u)random –If only seed is generated – same problem • •while(obtained < requested){ • bytes = read(file, buffer, requested - obtained); • if (bytes < 0){ …unable to read from file…} • else {obtained += bytes} •} 4 I PA193 - Introductory info P:\CRCS\2012_0178_Redesign_loga_a_JVS\PPT_prezentace\sablona\pracovni\normalni.jpg Consultations •You can discuss your points 6.10 after the Seminar 5 I PA193 - Introductory info