Skip to content

Instantly share code, notes, and snippets.

View AjayKumar465's full-sized avatar
🏹
Focusing

Ajay AjayKumar465

🏹
Focusing
View GitHub Profile
@AjayKumar465
AjayKumar465 / RsaExample.java
Created February 19, 2020 10:27 — forked from nielsutrecht/RsaExample.java
Example of RSA generation, sign, verify, encryption, decryption and keystores in Java
import javax.crypto.Cipher;
import java.io.InputStream;
import java.security.*;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class RsaExample {
public static KeyPair generateKeyPair() throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");