Java Key Pair Create generateKeyPair(final String algorithm, final int keylen)

Here you can find the source of generateKeyPair(final String algorithm, final int keylen)

Description

generate Key Pair

License

Open Source License

Declaration

public static KeyPair generateKeyPair(final String algorithm, final int keylen)
            throws NoSuchAlgorithmException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

public class Main {
    public static KeyPair generateKeyPair(final String algorithm, final int keylen)
            throws NoSuchAlgorithmException {

        KeyPairGenerator kpGen = KeyPairGenerator.getInstance(algorithm);
        SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
        kpGen.initialize(keylen, random);
        return kpGen.generateKeyPair();
    }// w  ww.  j av  a2  s  .co  m
}

Related

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