Java RSA generateRSA(int keySize)

Here you can find the source of generateRSA(int keySize)

Description

generate RSA

License

Open Source License

Declaration

public static KeyPair generateRSA(int keySize) throws NoSuchAlgorithmException, NoSuchProviderException 

Method Source Code

//package com.java2s;
/*************************************************************************
 *                                                                       *
 *  SignServer: The OpenSource Automated Signing Server                  *
 *                                                                       *
 *  This software is free software; you can redistribute it and/or       *
 *  modify it under the terms of the GNU Lesser General Public           *
 *  License as published by the Free Software Foundation; either         *
 *  version 2.1 of the License, or any later version.                    *
 *                                                                       *
 *  See terms of license at gnu.org.                                     *
 *                                                                       *
 *************************************************************************/

import java.security.*;

public class Main {
    public static KeyPair generateRSA(int keySize) throws NoSuchAlgorithmException, NoSuchProviderException {
        KeyPairGenerator g = KeyPairGenerator.getInstance("RSA", "BC");
        g.initialize(keySize, new SecureRandom());
        return g.generateKeyPair();
    }// ww w  . ja va2  s .co m
}

Related

  1. generateKeys()
  2. generateRSAKey(int keySize)
  3. generateRSAKeyPair()
  4. generateRSAKeyPair()
  5. generateRsaKeyPair()