<span id="mailbox-conversation">Cool, I'll look at this</span><div class="mailbox_signature">—<br>abstractj</div>
<br><br><div class="gmail_quote"><p>On Fri, Apr 4, 2014 at 12:07 PM, Karel Piwko <span dir="ltr">&lt;<a href="mailto:kpiwko@redhat.com" target="_blank">kpiwko@redhat.com</a>&gt;</span> wrote:<br></p><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>On Fri, 4 Apr 2014 10:49:53 -0300<br>Bruno Oliveira &lt;bruno@abstractj.org&gt; wrote:<br><br>&gt; Good morning slackland, yesterday I had a hangout with Matthias and we agreed<br>&gt; that the whole key agreement thing would bring more complexity from the<br>&gt; developer’s pespective. That’s the reason why the client with airline was<br>&gt; dropped.<br>&gt; <br>&gt; Here comes the new<br>&gt; proposal: https://gist.github.com/abstractj/ef1e3d53619796f4e87e<br>&gt; <br>&gt; # Passphrase encryption for UPS<br>&gt; <br>&gt; **Note**: This is NOT a replacement for SSL<br>&gt; <br>&gt; ## Scenario<br>&gt; <br>&gt; - Developers wants to upload passphrase and certificate for iOS variants. The<br>&gt; passphrase must be stored encrypted and restored in clear while sending<br>&gt; messages.<br>&gt; <br>&gt; ## Jira references<br>&gt; <br>&gt; - https://issues.jboss.org/browse/AGPUSH-565 (*Dropped*). After a hangout<br>&gt; with Matthias, we agreed that would complicate the developer's workflow.<br>&gt; - https://issues.jboss.org/browse/AGPUSH-358<br>&gt; <br>&gt; ## Proposal<br>&gt; <br>&gt; Today we can't guarantee that our developers will have an<br>&gt; [HSM](http://en.wikipedia.org/wiki/Hardware_security_module) to manage<br>&gt; encryption keys. Neither we can store the private keys in a separated<br>&gt; database, for the push server.<br>&gt; <br>&gt; If somehow the database is compromised, private keys could be exposed and<br>&gt; most of the sensitive data decrypted. <br>&gt; <br>&gt; The suggestion is to make use of a *KDF function* per application to encrypt<br>&gt; passphrases, not perfect, but helps (like we did in the past for password<br>&gt; reset). Where encryption key means:<br>&gt; <br>&gt; ```<br>&gt; PK = PBKDF2(Secret Key, Salt)<br>&gt; ```<br>&gt; <br>&gt; *Secret Key*: In the ideal world, users would be required to provide a<br>&gt; password for encryption. In this scenario we don't want them to be prompted<br>&gt; to input the password, or add extra parameters to the UPS endpoints. So the<br>&gt; suggestion is to provide secret key configured on the server and protected by<br>&gt; the ACL's from the operating system<br><br>I believe this should be pluggable, not only FS based. For instance, on<br>AS7/EAP/WF, you'd likely want to use Vault to store sensitive information:<br><br>https://access.redhat.com/site/documentation//en-US/JBoss_Enterprise_Application_Platform/6.2/html/Security_Guide/sect-Password_Vaults_for_Sensitive_Strings.html<br><br>On other containers/platforms, you might have different options. FileSystem is a<br>good start, but flexibility of such mechanism rocks.<br><br><br><br>&gt; <br>&gt; *Salt*: 16 bytes non-deterministic used to encrypt/decrypt the data on the<br>&gt; server per application and stored into the database.<br>&gt; <br>&gt; ![](http://photon.abstractj.org/cdraw_460528_pixels_20140404_103644_20140404_103648.jpg)<br>&gt; <br>&gt; ### Secret key configuration<br>&gt; <br>&gt; The file can be generated and checked if something exists during the<br>&gt; application start up.<br>&gt; <br>&gt; - config.properties<br>&gt; <br>&gt; ```<br>&gt; secret_key =<br>&gt; "d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532" \<br>&gt; "18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b" ```<br>&gt; <br>&gt; or<br>&gt; <br>&gt; - config.json<br>&gt; <br>&gt; ```<br>&gt; {"secret_key":"d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532"<br>&gt; \ "18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b"}<br>&gt;  ```<br>&gt; <br>&gt; ### Sending push messages<br>&gt; <br>&gt; Passphrases must be reversible for Apple, that's why we make use of symmetric<br>&gt; encryption here.<br>&gt; <br>&gt; ![](http://photon.abstractj.org/cdraw_537346_pixels_20140404_104245_20140404_104247.jpg)<br>&gt; <br>&gt; # REST API<br>&gt; <br>&gt; <br>&gt; ## Register push app<br>&gt; <br>&gt; ```POST    |    rest/applications```<br>&gt; <br>&gt; ### HTTP request <br>&gt; <br>&gt;   Remain unchanged <br>&gt; <br>&gt; ### HTTP response <br>&gt; <br>&gt;   Remain unchanged<br>&gt;   <br>&gt; ## iOS Variant <br>&gt; <br>&gt; ### HTTP request <br>&gt; <br>&gt;   Remain unchanged <br>&gt; <br>&gt; ### HTTP response <br>&gt; <br>&gt;   Remain unchanged<br>&gt; <br>&gt; ## Sender <br>&gt; <br>&gt; ### HTTP request <br>&gt; <br>&gt;   Remain unchanged <br>&gt; <br>&gt; ### HTTP response <br>&gt; <br>&gt;   Remain unchanged<br>&gt; <br>&gt; <br>&gt; # Clients <br>&gt; <br>&gt; No changes at the client side.<br>&gt; <br>&gt; <br>&gt; Thoughts?<br>&gt; <br>&gt; --  <br>&gt; abstractj<br>&gt; <br>&gt; _______________________________________________<br>&gt; aerogear-dev mailing list<br>&gt; aerogear-dev@lists.jboss.org<br>&gt; https://lists.jboss.org/mailman/listinfo/aerogear-dev<br><br>_______________________________________________<br>aerogear-dev mailing list<br>aerogear-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</p></blockquote></div><br>