Thread-safe RSA De/Encryption utility for Byte-Arrays


Here’s an utility i wrote to encrypt and decrypt small (max 117 Byte) byte-arrays/Strings with (Java-built-in) RSA in a thread safe way.
The RSAPublicKeyUtility allows you to do RSAPublicKey <-> byte-array/String conversion for easy public-key sharing.

Default settings are a keysize of 1024 and “RSA/ECB/PKCS1Padding”-cipher
KeyPair is generated when first loading the class and kept for the lifetime of the VM.

This is basically an easy-use wrapper around Javas RSA-encryption, originally built to send passwords securely.

The tests I used to validate the utility:

Yell if you find something that smells funny :smiley:

cool thanks! :smiley: