Cryptography Tricks

From PS3 Developer wiki
Jump to: navigation, search

Here are some cryptography tricks that I have learned with some important people and that helped to make this page. They helped a lot with the Keys and Seeds page construction. Use them wisely :) - Zecoxao

AES-CTR tricks[edit]

  • Recovery of partial plaintext with two ciphertexts encrypted with same (key, iv) pair by knowing where zeroes (\x00) are located. This trick was used in the recovery of the PS3 ebootrom keys. Xoring these ciphertexts will reveal plaintext where in both locations there are zeroes in one place and plaintext in the other.
  • AES-CTR encryption is the exact same operation as decryption. If you can make the hardware (black box) decrypt for you, you can also make it encrypt. This trick was used in PS Vita CEX2DEX after ConsoleId Certificate modification to generate AES-CMAC hash without even knowing the AES-CMAC key nor having "encrypt" permission on this AES-CMAC key in the crypto-processor.

AES-CBC tricks[edit]

  • The iv of a CBC operation is always the previous block of the ciphered text when decrypting it into the plaintext, except when it is the starting operation: in this case iv is specified by the end-user.

AES-ECB tricks[edit]

  • If CBC is used on a block and if the attacker knows where a block full of zeroes is located in known plaintext with given ciphertext location, the attacker can use AES-ECB with the guessed key on that location. If there is a match of the previous block as result, the attacker automatically knows that the guessed key is the correct key. This means that the first block of the ciphered text will be equal to the second block of the plaintext of the ECB decryption, if the plaintext is supposed to have zeroes in the CBC decryption and the ECB/CBC key is correct.

AES-CTR and AES-CBC tricks[edit]

  • If the plaintext starting block contains zeroes only and is encrypted with AES-CBC, the attacker can use AES-CTR to know if the (key, iv) pair is correct. Simply attempt to AES-CTR decrypt said block using the given (key, iv) pair, and if it turns out full of zeroes, then it is the correct (key, iv) pair. This only works if the starting block is full of zeroes.