

Ask HN: Is my unorthodox approach to server security a bad idea? - MarkMc

I&#x27;ve heard people say again and again that you shouldn&#x27;t implement your own security algorithm, and I&#x27;d like to ask HN if I&#x27;m breaking this rule.<p>I&#x27;m creating a traditional client-server application with a twist: I want to encrypt all data on the client so that even an attacker who gains complete control over my server will be unable to access the users&#x27; data.  That is, I want end-to-end encryption for my client-server application.<p>The client encrypts the user&#x27;s data with a cryptographic key derived from the user&#x27;s password, so it&#x27;s important that the server not be able to figure out the password because that would allow the server to decrypt the user&#x27;s data.
 The client therefore uses Secure Remote Password protocol to avoid sending the password to the server.  So far so good.<p>Now here&#x27;s where my design gets a little unorthodox.  The problem is that users in general are very bad at creating passwords - usually picking a password from the top 10,000 passwords list - which would make it pretty easy for an attacker who has access to the server to decrypt the user&#x27;s data.  Therefore I plan to generate a random set of characters and append them to the User ID field, so the user would need to log in with something like these credentials:<p><pre><code>  User ID: John-CPE4E38J
  Password: snoopy
</code></pre>
But before processing these credentials the login code moves the random characters to the password so the underlying SRP authentication library sees this:<p><pre><code>  User ID: John
  Password: snoopy-CPE4E38J
</code></pre>
In addition, the client offers to remember the User ID (ie. John-CPE4E38J) so that most of the time the user only has to remember their password.<p>What do you think of this approach?  Am I breaking the do-not-implement-your-own-security-algorithm rule?  Or is this a good way to strengthen the security of my application?<p>[1] http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Secure_Remote_Password_protocol
======
alexbosworth
Do you store the user ids?

~~~
MarkMc
Yes, the client will store the User ID (eg. John-CPE4E38J) on local hard disk.
The server will store the modified User ID (ie. John) in the database.

