Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aramezx/e50d90af51877e6608c981e03d371a76 to your computer and use it in GitHub Desktop.
Save aramezx/e50d90af51877e6608c981e03d371a76 to your computer and use it in GitHub Desktop.
if you need to implement RSA key exchange, you can easily make use of OAEP padding like this:
/* if you need to implement RSA key exchange, you can easily make use of OAEP padding like this: */
ndroidRsaEngine rsa = new AndroidRsaEngine("key1", false);
Digest digest = new SHA512Digest();
Digest mgf1digest = new SHA512Digest();
OAEPEncoding oaep = new OAEPEncoding(rsa, digest, mgf1digest, null);
oaep.init(true, null);
byte[] cipherText = oaep.processBlock(plainBytes, 0, plainBytes.length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment