private static void assertPSSParameterSpecEquals(
        PSSParameterSpec spec1, PSSParameterSpec spec2) {
        assertEquals(
                getDigestAlgorithmCanonicalName(spec1.getDigestAlgorithm()),
                getDigestAlgorithmCanonicalName(spec2.getDigestAlgorithm()));
        assertEquals(
                getMGFAlgorithmCanonicalName(spec1.getMGFAlgorithm()),
                getMGFAlgorithmCanonicalName(spec2.getMGFAlgorithm()));

        AlgorithmParameterSpec spec1MgfParams = spec1.getMGFParameters();
        assertNotNull(spec1MgfParams);
        if (!(spec1MgfParams instanceof MGF1ParameterSpec)) {
            fail("Unexpected type of MGF parameters: " + spec1MgfParams.getClass().getName());
        }
        MGF1ParameterSpec spec1Mgf1Params = (MGF1ParameterSpec) spec1MgfParams;
        AlgorithmParameterSpec spec2MgfParams = spec2.getMGFParameters();
        assertNotNull(spec2MgfParams);
        if (!(spec2MgfParams instanceof MGF1ParameterSpec)) {
            fail("Unexpected type of MGF parameters: " + spec2MgfParams.getClass().getName());
        }
        MGF1ParameterSpec spec2Mgf1Params = (MGF1ParameterSpec) spec2MgfParams;

        assertEquals(
                getDigestAlgorithmCanonicalName(spec1Mgf1Params.getDigestAlgorithm()),
                getDigestAlgorithmCanonicalName(spec2Mgf1Params.getDigestAlgorithm()));
        assertEquals(spec1.getSaltLength(), spec2.getSaltLength());
        assertEquals(spec1.getTrailerField(), spec2.getTrailerField());
    }
Payload of SEQUENCE extends beyond the SEQUENCE.
common/src/test/java/org/conscrypt/java/security/AlgorithmParametersPSSTest.java