private void testInputPKCS1Padding(String provider, byte[] prePaddedPlainText, Key encryptKey, Key decryptKey) throws Exception {
        Cipher encryptCipher = Cipher.getInstance("RSA/ECB/NoPadding", provider);
        encryptCipher.init(Cipher.ENCRYPT_MODE, encryptKey);
        byte[] cipherText = encryptCipher.doFinal(prePaddedPlainText);
        encryptCipher.update(prePaddedPlainText);
        encryptCipher.init(Cipher.ENCRYPT_MODE, encryptKey);
        byte[] cipherText2 = encryptCipher.doFinal(prePaddedPlainText);
        assertEquals(Arrays.toString(cipherText),
                     Arrays.toString(cipherText2));

        Cipher decryptCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", provider);
        decryptCipher.init(Cipher.DECRYPT_MODE, decryptKey);
        byte[] plainText = decryptCipher.doFinal(cipherText);
        assertEquals(Arrays.toString(ORIGINAL_PLAIN_TEXT),
                     Arrays.toString(plainText));
        decryptCipher.update(prePaddedPlainText);
        decryptCipher.init(Cipher.DECRYPT_MODE, decryptKey);
        byte[] plainText2 = decryptCipher.doFinal(cipherText);
        assertEquals(Arrays.toString(plainText),
                     Arrays.toString(plainText2));
    }
Try various .init(...) calls with null parameters to make sure it is
handled.
common/src/test/java/org/conscrypt/javax/crypto/CipherTest.java