Java RSA generateRSAKeyPair()

Here you can find the source of generateRSAKeyPair()

Description

Create a random 1024 bit RSA key pair

License

Open Source License

Declaration

public static KeyPair generateRSAKeyPair() throws Exception 

Method Source Code

//package com.java2s;

import java.security.KeyPair;
import java.security.KeyPairGenerator;

import java.security.SecureRandom;

public class Main {
    /**/*from  www .  j  a  va 2s .c o  m*/
     * Create a random 1024 bit RSA key pair
     */
    public static KeyPair generateRSAKeyPair() throws Exception {
        KeyPairGenerator kpGen = KeyPairGenerator.getInstance("RSA", "BC");

        kpGen.initialize(1024, new SecureRandom());

        return kpGen.generateKeyPair();
    }
}

Related

  1. generateKeys()
  2. generateRSA(int keySize)
  3. generateRSAKey(int keySize)
  4. generateRSAKeyPair()
  5. generateRsaKeyPair()
  6. generateRSAKeyPair()
  7. generateRSAKeyPair(final int bits)