private static AlgorithmParameterSpec getDecryptAlgorithmParameterSpec(AlgorithmParameterSpec encryptSpec,
                                                                           Cipher encryptCipher) {
        String algorithm = encryptCipher.getAlgorithm().toUpperCase(Locale.US);
        if (isPBE(algorithm)) {
            return encryptSpec;
        }
        if (isOnlyWrappingAlgorithm(algorithm)) {
            return null;
        }
        byte[] iv = encryptCipher.getIV();
        if (iv != null) {
            if ("AES/GCM/NOPADDING".equals(algorithm)
                    || "AES_128/GCM/NOPADDING".equals(algorithm)
                    || "AES_256/GCM/NOPADDING".equals(algorithm)) {
                return new GCMParameterSpec(GCM_TAG_SIZE_BITS, iv);
            }
            if ("AES/GCM-SIV/NOPADDING".equals(algorithm)
                || "AES_128/GCM-SIV/NOPADDING".equals(algorithm)
                || "AES_256/GCM-SIV/NOPADDING".equals(algorithm)) {
                return new GCMParameterSpec(GCM_SIV_TAG_SIZE_BITS, iv);
            }
            return new IvParameterSpec(iv);
        }
        return null;
    }
Returns the key meant for deciphering for {@code algorithm}.
common/src/test/java/org/conscrypt/javax/crypto/CipherTest.java