Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-6908

SimplePush endpoint decryption fails due to incorrect secret key generation.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • None
    • None
    • None
    • None

    Description

      Kris found reported this issue and we were not sure where the problem was. I've been able to reproduce this by only using the SimplePush Server on OpenShift by directly sending a notification to a channel.
      The error I'm seeing (I've added some additional logging) is the following:

      2013/09/02 06:32:23,205 INFO  [org.jboss.aerogear.simplepush.server.netty.NotificationHandler] (nioEventLoopGroup-4-2) /update/NH6A7LiVX6PWj2F42FjnKKmOLYYhHwFt_kxdYyEFY0IuE0uapSQOW2a7aM5WqzWgUK-1mqU5gT6EKxcXQo5wGg
      2013/09/02 06:32:23,207 INFO  [org.jboss.aerogear.simplepush.util.CryptoUtil] (nioEventLoopGroup-4-2) Try to decrypt: [NH6A7LiVX6PWj2F42FjnKKmOLYYhHwFt_kxdYyEFY0IuE0uapSQOW2a7aM5WqzWgUK-1mqU5gT6EKxcXQo5wGg]
      2013/09/02 06:32:23,209 INFO  [org.jboss.aerogear.simplepush.util.CryptoUtil] (nioEventLoopGroup-4-2) Decrypting : [NH6A7LiVX6PWj2F42FjnKKmOLYYhHwFt_kxdYyEFY0IuE0uapSQOW2a7aM5WqzWgUK-1mqU5gT6EKxcXQo5wGg] with key [3ZILBAh8vNMU]
      2013/09/02 06:32:23,214 ERROR [org.jboss.aerogear.simplepush.server.netty.NotificationHandler] (nioEventLoopGroup-4-2) Error while processing notifiation:: java.security.ProviderException: doFinal() failed
              at sun.security.pkcs11.P11Cipher.implDoFinal(P11Cipher.java:814)
              at sun.security.pkcs11.P11Cipher.engineDoFinal(P11Cipher.java:542)
              at sun.security.pkcs11.P11Cipher.engineDoFinal(P11Cipher.java:525)
              at javax.crypto.Cipher.doFinal(Cipher.java:1922) [jce.jar:1.7.0_25]
              at org.jboss.aerogear.simplepush.util.CryptoUtil.decrypt(CryptoUtil.java:114) [aerogear-simplepush-server-core-0.8.0.jar:0.8.0]
              at org.jboss.aerogear.simplepush.util.CryptoUtil.decryptEndpoint(CryptoUtil.java:136) [aerogear-simplepush-server-core-0.8.0.jar:0.8.0]
              at org.jboss.aerogear.simplepush.server.netty.NotificationHandler$Notifier.call(NotificationHandler.java:124) [aerogear-simplepush-server-netty-0.8.0.jar:0.8.0]
              at org.jboss.aerogear.simplepush.server.netty.NotificationHandler$Notifier.call(NotificationHandler.java:110) [aerogear-simplepush-server-netty-0.8.0.jar:0.8.0]
              at io.netty.util.concurrent.PromiseTask.run(PromiseTask.java:73) [netty-all-4.0.5.Final-SNAPSHOT.jar:]
              at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [netty-all-4.0.5.Final-SNAPSHOT.jar:]
              at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:366) [netty-all-4.0.5.Final-SNAPSHOT.jar:]
              at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [netty-all-4.0.5.Final-SNAPSHOT.jar:]
              at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
      Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ENCRYPTED_DATA_INVALID
              at sun.security.pkcs11.wrapper.PKCS11.C_DecryptFinal(Native Method)
              at sun.security.pkcs11.P11Cipher.implDoFinal(P11Cipher.java:806)
              ... 12 more
      

      Steps to reproduce:
      1. Create an OpenShift application to work against:

      rhc create-app kris "https://cartreflect-claytondev.rhcloud.com/reflect?github=danbev/openshift-origin-cartridge-aerogear-push&commit=a448d69036150f720555a1b8929e231fb7719816" mysql-5.1
      

      2. Update the example and change the server url to point to the application created in step one.
      3. Again follow the steps example to register a channel and then send to that channel.

      Attachments

        Issue Links

          Activity

            People

              dbeveniu Daniel Bevenius (Inactive)
              dbeveniu Daniel Bevenius (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: