private synchronized static Key getEncryptKey(String algorithm) {
        Key key = ENCRYPT_KEYS.get(algorithm);
        if (key != null) {
            return key;
        }
        try {
            if (algorithm.startsWith("RSA")) {
                KeyFactory kf = KeyFactory.getInstance("RSA");
                RSAPublicKeySpec keySpec = new RSAPublicKeySpec(RSA_2048_modulus,
                        RSA_2048_publicExponent);
                key = kf.generatePublic(keySpec);
            } else if (isPBE(algorithm)) {
                SecretKeyFactory skf = SecretKeyFactory.getInstance(algorithm);
                key = skf.generateSecret(new PBEKeySpec("secret".toCharArray()));
            } else {
                KeyGenerator kg = KeyGenerator.getInstance(getBaseAlgorithm(algorithm));
                if (algorithm.startsWith("AES_256/")) {
                    // This is the 256-bit constrained version, so we have to switch from the
                    // default of 128-bit keys.
                    kg.init(256);
                }
                key = kg.generateKey();
            }
        } catch (Exception e) {
            throw new AssertionError("Error generating keys for test setup", e);
        }
        ENCRYPT_KEYS.put(algorithm, key);
        return key;
    }
Returns the key meant for enciphering for {@code algorithm}.
common/src/test/java/org/conscrypt/javax/crypto/CipherTest.java