Created
March 5, 2019 08:52
-
-
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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