<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 5, 2014 at 8:00 PM, Bruno Oliveira <span dir="ltr">&lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">There is no magic, the password must exist in some place. If not possible require the password, is possible to follow the same approach provided for password reset functionality.<br>

<br>
If you want to stick to the KeyStore, you still need to provide the password in some place, but that&rsquo;s more suitable when you have a key exchange or something like this.<br>
<br>
So if you patiently read my the code proposed, you will realize that is possible to achieve it via property file, database or whatever:<br>
<div class="im"><br>
@Test<br>
&nbsp; &nbsp; public void testPasswordValidationWithRandomSaltProvided() throws Exception {<br>
&nbsp; &nbsp; &nbsp; &nbsp; Pbkdf2 pbkdf2 = AeroGearCrypto.pbkdf2();<br>
&nbsp; &nbsp; &nbsp; &nbsp; byte[] salt = new Random().randomBytes();<br>
&nbsp; &nbsp; &nbsp; &nbsp; byte[] IV = new Random().randomBytes();<br>
&nbsp; &nbsp; &nbsp; &nbsp; int iterations = 100000;<br>
<br>
</div>&nbsp; &nbsp; &nbsp; &nbsp; read.secretFile(&ldquo;secret.properties&rdquo;);<br>
&nbsp; &nbsp; &nbsp; &nbsp; String PASSWORD = read.load(&ldquo;password_to_my_superpassphrase&rdquo;);<br></blockquote><div><br></div><div><br></div><div>yeah, but that is really per variant, not global. So we would need a lot of these secret file :-)&nbsp;</div>
<div><br></div><div><br></div><div><br></div><div>So, the passphrase is upload to the server (for all iOS variants), w/ this HTTP request:</div><div><br></div><div><a href="http://aerogear.org/docs/specs/aerogear-push-rest/Variants/iOS/">http://aerogear.org/docs/specs/aerogear-push-rest/Variants/iOS/</a><br>
</div><div><br></div><div><br></div><div>Somewhen later a totally different system submits a HTTP request to trigger the PUSH message delivery:</div><div><a href="http://aerogear.org/docs/specs/aerogear-push-rest/Sender/">http://aerogear.org/docs/specs/aerogear-push-rest/Sender/</a><br>
</div><div><br></div><div>And internally, only for iOS variant, all it needs is the certificate (from the apple developer portal) + its passphrase</div><div><br></div><div>Perhaps I am wrong, but I feel that if (for iOS variants) we start to require &quot;password_to_my_superpassphrase&quot; on the request for creating the logical construct of the variant,</div>
<div>and use the same for the Sender, we would have that magical password, but I fear that this opens a new can of worms.</div><div><br></div><div>&nbsp;<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class="im"><br>
&nbsp; &nbsp; &nbsp; &nbsp; //Encrypt step<br>
&nbsp; &nbsp; &nbsp; &nbsp; SecretKey secretKey = pbkdf2.generateSecretKey(PASSWORD, salt, iterations);<br>
&nbsp; &nbsp; &nbsp; &nbsp; CryptoBox box1 = new CryptoBox(secretKey.getEncoded());<br>
&nbsp; &nbsp; &nbsp; &nbsp; String passphrase = &quot;My bonnie lies over the ocean&quot;;<br>
&nbsp; &nbsp; &nbsp; &nbsp; byte[] ciphertext = box1.encrypt(IV, passphrase.getBytes());<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; //Decrypt step<br>
&nbsp; &nbsp; &nbsp; &nbsp; SecretKey recoveredKey = pbkdf2.generateSecretKey(PASSWORD, salt, iterations);<br>
}<br>
<br>
</div>If it&rsquo;s not clear, let me know where should I introduce this functionality rather than a pet project and I can do that.<br></blockquote><div><br></div><div><br></div><div>The AGPUSH-358 ticket is still yours :-) I just felt looking at it, while reading up on our crypto bits.</div>
<div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
--<br>
abstractj<br>
<div class=""><div class="h5"><br>
On February 5, 2014 at 4:47:04 PM, Matthias Wessendorf (<a href="mailto:matzew@apache.org">matzew@apache.org</a>) wrote:<br>
&gt; &gt; as said in the comments, I don&#39;t have that PASSWORD here<br>
&gt;<br>
&gt;<br>
&gt; That is only submitted when the user creates a new iOS variant,<br>
&gt; it&#39;s never entered when the server tries to connect to the APNs<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>