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.


5 Years
Discussion Span
Last Post by nezachem

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.