• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

Adding simple RSA algorithm to a project

I would like to add the public key algorithm RSA to a project. While I am generally famliar with public key cryptography (pretty much user knowledge, maybe a little more) I am not familiar with how to code it.

I keep finding a couple of algorithm source codes but nothing that I understand.

Basically I would like something that presents me the functions

Encrypt(..)
Decrypt(..)

and maybe

CreatePubKey(..)
CreatePrivKey(..)

something like that. Everything I find is awfully complicated (e.g. http://www.eskimo.com/~weidai/cryptlib.html) or too simple it seems.

Does anybody have suggestions? All I really need to encrypt / decrypt is ONE string - nothing more.

Thanks!
0
FlorianJaeger
Asked:
FlorianJaeger
  • 6
  • 4
1 Solution
 
gj62Commented:
Hello again - I thought you said this was just as easy as TEA... <just kidding>

Anyhow, have you looked at any of the PGP libraries - many of them are straightforward...  

You didn't say what platform you need, but here are several links to get you started...

http://www.pgpi.org/

Here's the direct link to the PGP programming libs for C/C++

Hope this helps...

0
 
akshayxxCommented:
see if this helps you...
http://web.comlab.ox.ac.uk/oucl/work/colin.percival/source/lib/rsa.html

quite close to what you need ..
0
 
akshayxxCommented:
forgot to tell that links to required sources and headers can be found one link UP

http://web.comlab.ox.ac.uk/oucl/work/colin.percival/source/lib/
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
akshayxxCommented:
did u try search on google
http://directory.google.com/Top/Science/Math/Applications/Communication_Theory/Cryptography/Programming_Libraries/


another link to a library that will give you RSA and a lot of other cryptographic tools

http://www.cs.auckland.ac.nz/~pgut001/cryptlib/


this  (http://mcrypt.hellug.gr/#_libmcrypt) i used to making tripwire-like host-based auditing tool..i used it for generating checksums of files on a unix/windows system .. which can be used to check if the files have been compromised by some hacker



i can post more links but u better have a look at the links on above directory.google link
ask if u have doubts for any specific library..

by the description and API-manual .. my first comment seems to fit in your needs
0
 
FlorianJaegerAuthor Commented:
akshayxx,

I think that's exactly what I was looking for. Please give me a some time to try it out and see if it works - but so far it looks very promising.

Thanks.
0
 
akshayxxCommented:
which one .. u r looking ..the first one ? if yes no need to comment back .. i'll take ur no comment as yes..
take ur time to figure out the working ..
by that time i'll also see it in my free time
0
 
FlorianJaegerAuthor Commented:
Yes I was talking about the first one.

Unfortunately I'm stalled. First it doesn't compile, I added it to a MFC project (all the required files) and included the "rsa.h" file and then called one of the functions from the RSA file.

When I compile it I get the message:

error LNK2001: unresolved external symbol "void __cdecl rsa_keygen(unsigned char *,unsigned char *,unsigned char *,unsigned int,unsigned char *)" (?rsa_keygen@@YAXPAE00I0@Z)
Release/RsaGui.exe : fatal error LNK1120: 1 unresolved externals

even though the rsa.obj file exists in the \Release directory.

I don't know if it's important but I switch the precompiled header feature off for this project since it wouldn't compile otherwise.

I don't understand ...
0
 
FlorianJaegerAuthor Commented:
Never mind, realized that I had to declare the function with "C" since it's a C function apparently.

extern "C" void rsa_keygen(uint8 * r,uint8 * pub,uint8 * priv,uint32 len,uint8 * T1);

Works now and maybe I'll figure it out how to even use it :-)
0
 
akshayxxCommented:
nice to know u r heading in positive direction..
0
 
FlorianJaegerAuthor Commented:
Thanks, the maintainer of the code was actually REALLY helpful in trying to help me.
0
 
akshayxxCommented:
well then he deserves all the credit
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now