Created
February 26, 2009 14:27
-
-
Save maio/70875 to your computer and use it in GitHub Desktop.
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
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "LoloCrypt" | |
RESOLVER ( (* TSOLAR) (* PUBLIC) ) | |
AS | |
import java.lang.*; | |
import java.io.*; | |
import oracle.security.crypto.core.*; | |
import oracle.security.crypto.util.*; | |
public class LoloCrypt { | |
public static String RSAEncrypt(String data, String pubKey_base64) { | |
try { | |
RSAPublicKey pubKey = | |
new RSAPublicKey(Utils.fromBase64(pubKey_base64)); | |
Cipher rsaEnc = | |
Cipher.getInstance(AlgID.rsaWithOAEPEncoding, pubKey); | |
return Utils.toBase64(rsaEnc.encrypt(data.getBytes())); | |
} | |
catch (Exception e) { | |
return "error: " + e.toString(); | |
} | |
} | |
}; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment