Java Key Pair Create generateKeyPair(final String algorithmModePad, final int keySize)

Here you can find the source of generateKeyPair(final String algorithmModePad, final int keySize)

Description

Generate KeyPair

License

Apache License

Parameter

Parameter Description
algorithmModePad a parameter
keySize a parameter

Declaration

public static KeyPair generateKeyPair(final String algorithmModePad, final int keySize) 

Method Source Code

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

import java.security.*;

public class Main {
    /**/* www .  jav a 2 s.com*/
     * Generate KeyPair
     * @param algorithmModePad
     * @param keySize
     * @return
     */
    public static KeyPair generateKeyPair(final String algorithmModePad, final int keySize) {
        KeyPair keyPair = null;

        try {
            final KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algorithmModePad);
            keyGen.initialize(keySize);

            keyPair = keyGen.generateKeyPair();

        } catch (Exception e) {
            e.printStackTrace();
        }

        return keyPair;
    }
}

Related

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