protected KeyPair buildKeyPair() {
        val algorithm = getAlgorithm();
        try {
            val keyGen = KeyPairGenerator.getInstance(algorithm);
            if (StringUtils.equals(algorithm, "RSA")) {
                keyGen.initialize(2048);
            }
            return keyGen.generateKeyPair();
        } catch (final NoSuchAlgorithmException e) {
            throw new TechnicalException(e);
        }
    }
A common class for key encryption tests.

@author Jerome Leleu
@since 4.0.0
pac4j-jwt/src/test/java/org/pac4j/jwt/config/AbstractKeyEncryptionConfigurationTests.java