I am looking for a PKC library, I would like one that is decently fast. I have looked at RSA, but I cannot seem to find any decent libraries that would work. I will be encrypting packets that are sent out via UDP, however one client will have the private key and the other will have the public key, these keys will not be exchanged as they will be hard coded into the program.

Thanks.

Recommended Answers

All 3 Replies

Hmmm... the whole premise of public-key encrpytion is that keys need to be shared, to some extent. You can still hard-code the keys you need into the sender application and the receiver application (rather than generate and exchange keys at run-time), but putting one key at each end shouldn't be sufficient.

How strong does your "encryption" need to be? If obfuscation is your goal, consider doing something like:
+ bitwise-XOR each 4-byte segment of the data against a fixed 32-bit integer
or (somewhat harder to decipher):
+ bitwise-XOR the first 4-byte segment of the data against a fixed 32-bit integer
+ then for each successive 4-byte segment, bitwise-XOR it against the result of the previous segment

For something a bit more encryption-like, search up "Blowfish". If you need actual strong encryption, then you have to follow the steps required by the scheme. If there were a shortcut, the encryption would be compromised!

No I need a Public/Private key, the method you stated wont be sufficient.

PKC is inherently slow. If performance is an issue, you may want to consider hybrid approach. Use PKC at the handshake phase, to securely exchange session keys. Then encrypt the payload with a symmetric algorithm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.