Hey Lei,
If you just want to make sure, a receiver dan decrypt the data, you may want to try to to decrypt the data before sending / storing / whatever it. Then you would simply check if the orirginal message equals the encrypted-decrypted message.
If you want to make sure that you received correct data, there are several possibilities:
- Integrity checking: Append a Hash to the end of your message (before encrypting it) and check the hash after decryption. (M' = E(M||H(M))), Hash-Functions are: SHA-512, SHA-256, SHA-3-512,...
- Authentication: Append a MAC-Value to the end of your message (like in 1), but this time you choose a MAC scheme, providing you the information that the sender actually sent and knew the data. You may want to use HMAC, VMAC, ...
- Authenticated mode: You may also use (for AES mainly) and authenticated encryption mode which can provide you the neccessary assurances as it has an authentication mechanism included. You may want to use EAX or something similar