I'm pretty sure that you don't understand what encryption is, and it would be a good idea if you found out before you started "playing" with code.
Quote:1. Does the Plain text needs to be in hashed format ?
No. If you do, you will destroy the data in the plain text file and will be unable to recover it. See here: Decrypting MD5 and SHA: Why You Can't Do It
Quote:2. Is a session key required ?
No. If you use a session based key, the data you encrypt will only be decryptable while the session is still current - when the session ends, the session key will be discarded and the encrypted data will no longer be recoverable. Keys are fundamental to all (non-trivial) encryption algorithms and are needed for both encryption and decryption.
In addition, we can't possible diagnose your problems from a vague description like "Parameter incorrect Error code 87 for CryptEncrypt" because we have no idea what your code looks like!
What I would suggest is that you start off by learning what encryption is, and how to implement it properly - because this is a very complicated subject and if you make mistakes, then either your encryption will mean your data is not recoverable (this is bad) or your data is not safe (this is worse). It is far, far to easy to mess this up if you do not know what you are doing (and depending on what you are doing with it, leave yourself wide open to prosecution and massive fines for infringing GDPR).
I'd start reading here if I was you: learning what encryption is, and how to implement it properly - Google Search