When using a protected constructor
javax.crypto.Cipher���(CipherSpi, Provider, String)
and running a standalone sample implementation an NPE could be thrown which is not specified anyhow.
Exception in thread "main" java.lang.NullPointerException
at java.base/javax.crypto.Cipher.<init>(Cipher.java:279)
at TestCipherSpi$MyCipher.<init>(TestCipherSpi.java:23)
at TestCipherSpi.main(TestCipherSpi.java:28)
===================
....
static class MyCipher extends Cipher {
protected MyCipher(javax.crypto.CipherSpi cipherSpi, Provider provider, String transformation) {
super(cipherSpi, provider, transformation);
}
}
public static void main(String[] args) throws Exception {
Cipher cipher = new MyCipher(mockedCipherSpi, new Provider("a", "b", "c") {
@Override
public Provider configure(String configArg) {
return super.configure(configArg);
}
}, "abc");
}
static CipherSpi mockedCipherSpi = new CipherSpi() {
...
===================
Please see the attached full code sample to reproduce the problem.