@SuppressWarnings("LiteralClassName")
    public static AlgorithmParameterSpec toGCMParameterSpec(int tagLenInBits, byte[] iv) {
        Class<?> gcmSpecClass;
        try {
            gcmSpecClass = Class.forName("javax.crypto.spec.GCMParameterSpec");
        } catch (ClassNotFoundException e) {
            gcmSpecClass = null;
        }

        if (gcmSpecClass != null) {
            try {
                Constructor<?> constructor = gcmSpecClass.getConstructor(int.class, byte[].class);
                return (AlgorithmParameterSpec) constructor.newInstance(tagLenInBits, iv);
            } catch (NoSuchMethodException | InstantiationException | IllegalAccessException
                    | IllegalArgumentException e) {
                logStackTraceSnippet("Can't find GCMParameterSpec class", e);
            } catch (InvocationTargetException e) {
                logStackTraceSnippet("Can't find GCMParameterSpec class", e.getCause());
            }
        }
        return null;
    }
Creates a platform version of {@code GCMParameterSpec}.
android/src/main/java/org/conscrypt/Platform.java