Hi,
I've been using the Bouncy Castle library with Mendix 7.1.
In Mendix 7.3 in the release notes it says: "Runtime will not globally register the Bouncy Castle Java library in order to prevent clashes with the usage of Bouncy Castle in the user libraries"
Thus I now register it myself after startup:
import org.bouncycastle.jce.provider.BouncyCastleProvider;
...
Security.addProvider(new BouncyCastleProvider());
Now, when I try to verify a signature
...
sig.init(new JcaPGPContentVerifierBuilderProvider().setProvider("BC"), publicKey);
...
I get an exception:
org.bouncycastle.openpgp.PGPException: cannot create signature: Error constructing implementation (algorithm: SHA256WITHRSA, provider: BC, class: org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider$JcaPGPContentVerifierBuilder.build(Unknown Source)
at org.bouncycastle.openpgp.PGPSignature.init(Unknown Source)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: SHA256WITHRSA, provider: BC, class: org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Signature.getInstance(Unknown Source)
at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider$JcaPGPContentVerifierBuilder.build(Unknown Source)
at org.bouncycastle.openpgp.PGPSignature.init(Unknown Source)
at licensing.LicenseTool.verifyData(LicenseTool.java:318)
...
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission""org.bouncycastle.pkcs1.not_strict""read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at org.bouncycastle.crypto.encodings.PKCS1Encoding$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.bouncycastle.crypto.encodings.PKCS1Encoding.useStrict(Unknown Source)
at org.bouncycastle.crypto.encodings.PKCS1Encoding.<init>(Unknown Source)
at org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Signature.getInstance(Unknown Source)
at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createSignature(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider$JcaPGPContentVerifierBuilder.build(Unknown Source)
at org.bouncycastle.openpgp.PGPSignature.init(Unknown Source)
at licensing.LicenseTool.verifyData(LicenseTool.java:318)
...
Has anyone encountered this or knows what I am doing wrong?