Powershell encryption and decryption

Dear expert

I would like to use Powershell to encrypt a file, then decrypt the file with a key. Is this possible to do? Using RSA 1024keys.
First I need to generate a key file and then I need to use that key file to open the encrypted file.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hasin Ahmed ChoudharyExchange AdministratorCommented:
Try this script https://gallery.technet.microsoft.com/Encryption-and-Decryption-f2476bb8
 It uses openssl.exe toll inside the PS script.

You can try to use any other tool  as in this link: https://www.makeuseof.com/tag/file-encryption-windows-powershell/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WeTiAuthor Commented:
Hi, thanks for the tips, I tried with the openssl way, it's working but you need to have openssl  same version to make things work now, i just tried: openssl 1.1.0h  version encryption and openssl 0.9.8h version. I encrypt the files in 1.1 version and tried to open with a older versin, same encryption method but didn't work, error message: Bad decryption.
WeTiAuthor Commented:
Openssl need to be in same version... or lower the encryption method to make it works. Newer version use a new encyption directory.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.