title: Is it possible to encrypt then decrypt data securely against a password in Python?
body: <p>I have some data in a python program that I'd like to encrypt before writing to a file with a password, and then read it and decrypt it before using it. I'm looking for some secure symmetric algorithm that can encrypt and decrypt against a password.</p>
  
  <p><a href="https://stackoverflow.com/questions/16761458/how-to-decrypt-openssl-aes-encrypted-files-in-python">This question</a> shows a non-secure way and suggests using libsodium. Since I'm using Python, I found <a href="https://github.com/stef/pysodium" rel="nofollow noreferrer">pysodium</a>. It seems to have tons of functions mapped from libsodium, but I don't know how to simply encrypt/decrypt data against password. </p>
  
  <p>My problem is that it looks like all encryption algorithms use keys. I don't want to use keys. I want to <em>only</em> use a password. Just like what I do in the terminal:</p>
  
  <p>To encrypt:</p>
  
  <pre><code>$ cat data | openssl aes-256-cbc -salt | dd of=output.des3
  </code></pre>
  
  <p>To decrypt:</p>
  
  <pre><code>$ dd if=output.des3 | openssl aes-256-cbc -d -salt
  </code></pre>
  
  <p>Is it possible to do this with pysodium (in a cross-platform way, so please don't suggest using a system call)?</p>