Skip to content

Instantly share code, notes, and snippets.

View sandi2382's full-sized avatar
🎯
Focusing

Sandi Pečečnik sandi2382

🎯
Focusing
View GitHub Profile
@sandi2382
sandi2382 / Decrypt.java
Created April 19, 2018 22:38 — forked from thedumbtechguy/Decrypt.java
RSA Encrypt in PHP and Decrypt in Java (Android)
---Java
//I used this on Android
//before you proceed, you need to ensure your private key is PKCS8 since that is what can be read natively in java.
//If your key begins with -----BEGIN RSA PRIVATE KEY-----, the it is ssleay and you need to convert it using the openssl command below
//openssl pkcs8 -topk8 -inform pem -in ssleay-private-key.key -outform pem -nocrypt -out pkcs8-private-key.pem
final private static String RSA_PRIVATE_KEY =
"-----BEGIN PRIVATE KEY-----\n" +
"MI...\n" +