pure-jcore/src/main/java/crypto/rsa/RSAKeyUtil.java
/**
     * Use Java to generate RSA keypair (self-make)
     */
Use Java to generate RSA keypair (self-make)
Use Java to generate RSA keypair ( self - make )
public static void generateKeyPair() throws NoSuchAlgorithmException {
        KeyPairGenerator generator = KeyPairGenerator.getInstance(RSA_ALGORITHM);
        generator.initialize(2048);
        KeyPair pair = generator.generateKeyPair();
        PublicKey pubKey = pair.getPublic();
        PrivateKey privateKey = pair.getPrivate();
        outputToFile(pubKey.getEncoded(), KEYFILE_PATH + PUBLIC_KEY_FILE_SELF_MAKE);
        outputToFile(privateKey.getEncoded(), KEYFILE_PATH + PRIVATE_KEY_FILE_SELF_MAKE);
    }
public static void generateKeyPair ( ) throws NoSuchAlgorithmException { KeyPairGenerator generator = KeyPairGenerator . getInstance ( RSA_ALGORITHM ) ; generator . initialize ( 2048 ) ; KeyPair pair = generator . generateKeyPair ( ) ; PublicKey pubKey = pair . getPublic ( ) ; PrivateKey privateKey = pair . getPrivate ( ) ; outputToFile ( pubKey . getEncoded ( ) , KEYFILE_PATH + PUBLIC_KEY_FILE_SELF_MAKE ) ; outputToFile ( privateKey . getEncoded ( ) , KEYFILE_PATH + PRIVATE_KEY_FILE_SELF_MAKE ) ; }
Use Java to generate RSA keypair (self-make)
Use Java to generate RSA keypair ( self - make )
// generate keypair // export pub & private key