1 | import javax.crypto.Cipher; |
2 | |
3 | // Encrypt using RSA private key |
4 | sS rsaEncrypt(S plainText, PrivateKey privateKey) ctex {
|
5 | Cipher cipher = Cipher.getInstance("RSA");
|
6 | cipher.init(Cipher.ENCRYPT_MODE, privateKey); |
7 | ret base64(cipher.doFinal(toUtf8(plainText)); |
8 | } |
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1019601 |
| Snippet name: | rsaEncrypt - only takes short data (like a symmetric key) |
| Eternal ID of this version: | #1019601/3 |
| Text MD5: | a902f085ddf253f8c95580d5d3fc18fe |
| Author: | stefan |
| Category: | javax / encryption |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-11-14 00:11:30 |
| Source code size: | 268 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 553 / 587 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |