Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19871

RESTEasy - java.lang.NullPointerException with ibm-java-1.8

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 7.4.0.CR2
    • 7.4.0.CD20
    • REST
    • None

    Description

      Running with ibm-java-1.8 we get the following Exception:

      Caused by: java.lang.NullPointerException
      	at org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPrivateKey.getAlgorithm(BCRSAPrivateKey.java:79)
      	at com.ibm.crypto.provider.bf.supportsParameter(Unknown Source)
      	at javax.crypto.Cipher.a(Unknown Source)
      	at javax.crypto.Cipher.init(Unknown Source)
      	at javax.crypto.Cipher.init(Unknown Source)
      	at org.bouncycastle.operator.jcajce.JceAsymmetricKeyUnwrapper.generateUnwrappedKey(JceAsymmetricKeyUnwrapper.java:109)
      	at org.bouncycastle.cms.jcajce.JceKeyTransRecipient.extractSecretKey(JceKeyTransRecipient.java:208)
      	at org.bouncycastle.cms.jcajce.JceKeyTransEnvelopedRecipient.getRecipientOperator(JceKeyTransEnvelopedRecipient.java:26)
      	at org.bouncycastle.cms.KeyTransRecipientInformation.getRecipientOperator(KeyTransRecipientInformation.java:48)
      	at org.bouncycastle.cms.RecipientInformation.getContentStream(RecipientInformation.java:169)
      	at org.bouncycastle.cms.RecipientInformation.getContent(RecipientInformation.java:150)
      	at org.jboss.resteasy.security.smime.EnvelopedInputImpl.getEntity(EnvelopedInputImpl.java:168)
      	... 76 more

      We didn't have this error in CD19.
      Both CD19 and CD20 run with ibm-java-1.8 version 8.0.6.6.

      Find attached:

      The server CryptoTest.war is taken from RESTEasy test org.jboss.resteasy.test.crypto.CryptoTest#testEncryptedInput and the code handling the POST request is the following (method org.jboss.resteasy.test.crypto.resource.CryptoEncryptedResource#post):

      @Path("/smime/encrypted")
      public class CryptoEncryptedResource {
         @POST
         public void post(EnvelopedInput<String> input) {
            String str = input.getEntity(CryptoCertResource.privateKey, CryptoCertResource.cert);
            Assert.assertEquals("input", str);
         }
      }
      

      The code generating the POST can be found in method org.jboss.resteasy.test.crypto.CryptoTest#testEncryptedInput.

      Attachments

        1. CryptoTest.war
          13 kB
        2. log.txt
          10 kB

        Issue Links

          Activity

            People

              rhn-engineering-ema Jim Ma
              tborgato@redhat.com Tommaso Borgato
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: