Search code examples
securityencryptioncryptographyaeschecksum

Encrypting file with checksum of the same file


How safe is it to encrypt your files with a cipher like AES-256-CBC with the checksum of the same file, used as a key? Is that a risk, or is it safe?

Like this steps:

  1. Generating the checksum of a file
  2. Encrypting file with checksum of the file
  3. Saving encrypted file on a server or disk
  4. Encrypting checksum with a RSA/ECC Public key
  5. Saving encrypted checksum on a server or disk

Decrypting:

  1. Decrypting checksum with RSA/ECC Private key
  2. Using checksum to decrypt file

Are my ideas safe?


Solution

  • CodesInChaos answered my question with a URL. I want to redirect you to: