title: Encrypt string in javascript, that can be decrypted with a password, that can't be easily brute-forced
body: <p>I am hoping to be able to do this:</p>
  
  <ol>
  <li>Encrypt a string in the browser, with a password from the user</li>
  <li>Send that string to my server</li>
  <li>Allow anyone to request that string from my server</li>
  <li>The string can be decrypted by someone with the password</li>
  <li>Anyone <em>without</em> the password should need millions of dollars/years to decrypt the string</li>
  </ol>
  
  <p>I've found <a href="https://stackoverflow.com/questions/18279141/javascript-string-encryption-and-decryption">this thread</a> which uses AES to encrypt and decrypt a password. But testing it with my data, the decrypt function runs in 50 milliseconds. That'd be 1,728,000 password attempts in a day, just in the browser. If someone really wanted to break that encryption, I'm sure it'd be doable in short order.</p>
  
  <p>My second intuition says that I should keep it on the server behind a password. You send the ID of the data you need, and the password, and it sends back your encrypted data. This solves the problem of #3, but <em>I</em> could still decrypt the data if I really wanted to.</p>
  
  <p>Is there a way to do this were I, the server runner, doesn't need to be trusted? Assume the user can trust/validate what data they're sending to the server, and how it's encrypted in the browser.</p>