<div dir="ltr">Sorry if my e-mail gave to you a wrong impression. I was just asking about the interface to generate the secret.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 30, 2014 at 11:51 AM, Stian Thorgersen <span dir="ltr">&lt;<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">BTW the interface I proposed wouldn&#39;t work with a HSM, they do the encryption/decryption on board don&#39;t they? So it would be something like:<br>


<br>
public EncryptionProvider {<br>
<br>
&nbsp; public void generateKeys(RealmModel realm);<br>
<br>
&nbsp; public byte[] encrypt(byte[] b);<br>
<br>
&nbsp; public byte[] decrypt(byte[] b);<br>
<br>
&nbsp; public byte[] sign(byte[] b);<br>
<br>
}<br>
<br>
or something along those lines ;)<br>
<div class="im"><br>
----- Original Message -----<br>
&gt; From: &quot;Bruno Oliveira&quot; &lt;<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>&gt;<br>
&gt; To: &quot;Bill Burke&quot; &lt;<a href="mailto:bburke@redhat.com">bburke@redhat.com</a>&gt;, &quot;Stian Thorgersen&quot; &lt;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&gt;<br>
&gt; Cc: <a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
&gt; Sent: Thursday, 30 January, 2014 1:22:35 PM<br>
&gt; Subject: Re: [keycloak-dev] Storage protection<br>
&gt;<br>
</div><div class="im">&gt; I think that&rsquo;s just fine, where developers will store their private keys is<br>
&gt; their decision: db, text file or fancy hardwares.<br>
&gt;<br>
&gt; My only suggestion is to generate these keys with some KDF function, maybe<br>
&gt; during the first application setup? What do you have in mind Stian? command<br>
&gt; line, web interface, integrate with jboss-cli?<br>
<br>
</div>First app startup I&#39;d say. OOTB experience should be as simple as possible. Probably just bootstrap it in: <a href="https://github.com/keycloak/keycloak/blob/master/server/src/main/java/org/keycloak/server/KeycloakServerApplication.java" target="_blank">https://github.com/keycloak/keycloak/blob/master/server/src/main/java/org/keycloak/server/KeycloakServerApplication.java</a><br>


<br>
and set the location to ${jboss.config.dir}/keycloak.secret or something?<br>
<div class="HOEnZb"><div class="h5"><br>
&gt;<br>
&gt; --<br>
&gt; abstractj<br>
&gt;<br>
&gt; On January 30, 2014 at 8:12:44 AM, Stian Thorgersen (<a href="mailto:stian@redhat.com">stian@redhat.com</a>) wrote:<br>
&gt; &gt; &gt; We should do it as an SPI to make it extensible. This would allow<br>
&gt; &gt; admins to integrate it best into how they manage sensitive data.<br>
&gt; &gt; I don&#39;t know what common practices are, but I imagine there are<br>
&gt; &gt; many ways to do it.<br>
&gt; &gt;<br>
&gt; &gt; As I said before I think our options OOTB are either to just store<br>
&gt; &gt; in clear-text, or generate a master password and write to a known<br>
&gt; &gt; location (/standalone/data/realm.secret?).<br>
&gt; &gt; Anything more than that would make it hard to use for development.<br>
&gt; &gt;<br>
&gt; &gt; I believe it is safer store a master password in a file (and an additional<br>
&gt; &gt; layer of defence to storing in clear-text to RDBMS, which can<br>
&gt; &gt; be compromised through SQL-injection attacks that non-shared<br>
&gt; &gt; file systems are not prone to).<br>
&gt; &gt;<br>
&gt; &gt; The master password location can be configurable through a system<br>
&gt; &gt; property. Admins can place this file on an encrypted location,<br>
&gt; &gt; this would be recommended. I don&#39;t think its any better to provide<br>
&gt; &gt; the master password as a argument or system property at startup<br>
&gt; &gt; than it is to store it in a file on an encrypted drive. The reason<br>
&gt; &gt; being is that if someone gains admin access to the server, they<br>
&gt; &gt; will be able to read the file, sure, but they can also get the arguments<br>
&gt; &gt; used to start the server just as easily. If the server is turned<br>
&gt; &gt; of neither properties or an encrypted drive will help them. Admins<br>
&gt; &gt; already have mechanisms in place to manage encrypted drives<br>
&gt; &gt; on servers, so we&#39;d rely on them to know how to do that themselves.<br>
&gt; &gt;<br>
&gt; &gt; For future and more improved solutions we can add whatever mechanisms<br>
&gt; &gt; users are asking for through the SPI. Enterprises can also implement<br>
&gt; &gt; their own.<br>
&gt; &gt;<br>
&gt; &gt; The SPI could be something as simple as:<br>
&gt; &gt;<br>
&gt; &gt; public interface PrivateKeyProvider {<br>
&gt; &gt; public PEM getPrivateKey(RealmModel realm);<br>
&gt; &gt; }<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><br></div>--&nbsp;<br>&quot;The measure of a man is what he does with power&quot; - Plato<br>-<br>@abstractj<br>-<br>Volenti Nihil Difficile
</div>