Hi All,
 I am looking to encrypt some text and store it in a file. I am also looking to decrypt n retrive the text, using a eky.
Is anybodsy aware of some source code that could achive such a functionality.
Appreciate the help.
Who is Participating?
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.

On UNIX, you can use the standard crypt function.  It's weak, but may be enough for your purposes.  If you need something that meets current standards, then the Crypto++ library (the first link in Axter's answer) is the place to start for source or portable code.  If you're only interested in Microsoft Windows, then MS has a Crypto API with strong encryption.

preetham_mpAuthor Commented:
What i am looking at is some implementation of a RC4 "type" encryption algorithm..one
which does not require to get a license to use.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

What OS?
What compiler?

What type of application(MFC, Win32-App, Win32-Console)?

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
//function used for en/decrypting text
void crypttext(char *szText, char *szKey, unsigned int iTextSize, unsigned int iKeySize)
   for (int i = 0;i < iTextSize;i++)
      szText[i] ^= szKey[i % iKeySize];

int main()
   char cMessage[] = "this is my text, about to be encrypted";
   char cKey[] = "this is my key";
   crypttext(cMessage, cKey, sizeof(cMessage), sizeof(cKey));
   //text is now encrypted, just write it to a file
   crypttext(cMessage, cKey, sizeof(cMessage), sizeof(cKey));
   //text is now decrypted again
OpenSSL has an RC4 clone, and OpenSSL has no license fees (though some of its algorithms are patented in the US and cannot legally be used in the US without a patent owner).  I'm not sure what the current status of RC4 is, but there are other algorithms that serve the same purpose.  Crypto++ has a number of those.

No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: Axter {http:#9251418} & GaryFx {http:#9259258}

Please leave any comments here within the next seven days.

EE Cleanup Volunteer
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.