private KeyPair generateKeyPair(int keySize) throws NoSuchAlgorithmException {
        KeyPairGenerator generator = KeyPairGenerator.getInstance(KEYGEN_ALGORITHM);
        SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
        generator.initialize(keySize, secureRandom);
        return generator.generateKeyPair();
    }
Generate a root keystore by a given {@link JKS}.

@param jks A java keystore object.
@return A root {@link KeyStore}.
netbare-core/src/main/java/com/github/megatronking/netbare/ssl/CertificateGenerator.java