Java Key Pair Create generateKeyPair(int bit)

Here you can find the source of generateKeyPair(int bit)

Description

generate Key Pair

License

Apache License

Declaration

public static KeyPair generateKeyPair(int bit) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    private static final String KEY_ALGORTHM = "RSA";

    public static KeyPair generateKeyPair(int bit) throws Exception {
        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORTHM);
        keyPairGenerator.initialize(bit);
        KeyPair keyPair = keyPairGenerator.generateKeyPair();
        return keyPair;
    }/*w ww.j  a va2 s  . c  o m*/
}

Related

  1. generateKeyPair()
  2. generateKeyPair()
  3. generateKeyPair(final Provider provider, final String keyPairAlgorithm, final String secureAlgorithm)
  4. generateKeyPair(final String algorithm, final int keylen)
  5. generateKeyPair(final String algorithmModePad, final int keySize)
  6. generateKeyPair(int keySize)
  7. generateKeyPair(int keySize)
  8. generateKeyPair(int keySize)
  9. generateKeyPair(int keySize)