@Test
    public void testGetEncodedWithBrokenInput() throws Exception {
        AlgorithmParameters params = AlgorithmParameters.getInstance("PSS");
        try {
            params.init(BROKEN_SPEC1_DER_ENCODED);
            fail();
        } catch (IOException expected) {
        } catch (IllegalArgumentException expected) {
            // Bouncy Castle incorrectly throws an IllegalArgumentException instead of IOException.
            if (!"BC".equals(params.getProvider().getName())) {
                throw new RuntimeException(
                        "Unexpected exception. Provider: " + params.getProvider(),
                        expected);
            }
        }

        params = AlgorithmParameters.getInstance("PSS");
        try {
            params.init(BROKEN_SPEC2_DER_ENCODED);
            fail();
        } catch (IOException expected) {
        } catch (IllegalArgumentException expected) {
            // Bouncy Castle incorrectly throws an IllegalArgumentException instead of IOException.
            if (!"BC".equals(params.getProvider().getName())) {
                throw new RuntimeException(
                        "Unexpected exception. Provider: " + params.getProvider(),
                        expected);
            }
        }
    }
Payload of SEQUENCE extends beyond the SEQUENCE.
common/src/test/java/org/conscrypt/java/security/AlgorithmParametersPSSTest.java