Android examples for java.security:RSA
generate RSA Key Pair
//package com.java2s; import java.security.*; public class Main { public static KeyPair generateRSAKeyPair(int keySize) { KeyPair ret = null;/*from w w w . j a v a 2s . c o m*/ try { KeyPairGenerator generator = KeyPairGenerator .getInstance("RSA"); generator.initialize(keySize); ret = generator.generateKeyPair(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return ret; } }