Java Key Pair Create generateKeyPair()

Here you can find the source of generateKeyPair()

Description

generate Key Pair

License

Open Source License

Declaration

public static KeyPair generateKeyPair() 

Method Source Code

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

import java.security.*;

public class Main {
    private static final String ALGORITHM = "RSA";
    private static final int KEYSIZE = 1024;

    public static KeyPair generateKeyPair() {
        KeyPairGenerator keyPairGenerator = null;
        try {/*from  ww w  .  j  av  a  2  s.com*/
            keyPairGenerator = KeyPairGenerator.getInstance(ALGORITHM);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        keyPairGenerator.initialize(KEYSIZE);
        KeyPair keyPair = keyPairGenerator.generateKeyPair();
        return keyPair;
    }
}

Related

  1. generateKeyPair()
  2. generateKeyPair()
  3. generateKeyPair()
  4. generateKeyPair()
  5. generateKeyPair()
  6. generateKeyPair()
  7. generateKeyPair()
  8. generateKeyPair()
  9. generateKeyPair()