0
$\begingroup$

NOTE: Pardon my ignorance of encryption, I learned about these concepts today

Going to rephrase this question, but I think I already have fine answers provided. I need to have a block of data containing a message (user imputed) that is included in what I want to encrypt. I also need to have some means of authenticating the user, such as a password. The password will most likely be hashed for extra security. I am considering using a RSA public and private key pair of which the attacker can know, but wont be able to use, as he/she will need to authenticate themselves with a password of which they cannot know. Both the message (which I do not want the attacker to know) and the hashed password will be included inside the RSA encrypted data block (aka: RSA('message block', sha256('password')) ). Right now, my main question is if this is secure or not.

$\endgroup$
  • $\begingroup$ What is it that the server [knows or [can do]] that the attacker [[doesn't know] or [can't do]]? $\:$ What is it that the client [knows or [can do]] that the attacker [[doesn't know] or [can't do]]? $\;\;\;\;$ $\endgroup$ – user991 Jun 16 '15 at 0:28
1
$\begingroup$

if you want to use a password, SRP is probably a good choice. alternatively, you could use ECDHE with ECDSA or RSA keys. you should also use a MAC of some sort if you're using CBC (and encrypt then MAC). GCM or OCB would be much better choices.

| improve this answer | |
$\endgroup$
0
$\begingroup$

There is multiple solutions that's more sophisticated than this one. But you could easy authenticate the user if you have a secret that both the server and the client knows. By using the HMAC protocol example:

SHA256 ( SHA256 ( data_before_encryption ) + secret )

You create a hash of the the data you are sending before you encrypt it, and then you append the secret to that hash, and then create a new hash from the old hash + secret. The server can authenticate the user by doing the same operation after the data is decrypted. You can use SHA256 to this.

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ thats not how HMAC works $\endgroup$ – Richie Frame Jun 16 '15 at 1:13
  • $\begingroup$ Clarification with your answer and the one above, would a scheme such as this "rsa ( 'non-credential data' + sha256('password/sensitive data') ) " be a secure scheme to use? $\endgroup$ – user373043 Jun 16 '15 at 8:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.