How to tell if Data is AES Encrypted Data?
Question:
I really like your component but there’s one problem with Crypt2. Is there anyway to verify if the file is encrypted before decrypt? I’m asking this question is because if I try to decrypt an unencrypted file, that file will be corrupted.
Answer:
The output of any Chilkat Crypt2 method that does symmetric encryption (AES, Blowfish, Triple-DES, etc.) is simply encrypted data. There is no file format. Encrypted data will resemble random binary data where all byte values (from 0 to 0xFF) are used. The typical way to determine if a file is already encrypted is to use knowledge about the file that was encrypted. For example, if HTML was encrypted, one might first load the file and check to see if common HTML tags are present — if so, then the HTML file is not encrypted. You’ll need to devise your own ad-hoc method for determining whether data is encrypted or not.