Securing my password wallet I am currently learning C++, so I made this basic password wallet for Ubuntu.
Its source code is in the /opt directory and it has a  symlink so i can launch it from any directory using pw in the terminal.
Here is what it does:
It asks for a password (pass) and a site (which is related to the pass). It decrypts the file (test.enc) that contains the passwords to another file (text.txt), writes the pass and site to test.txt, encrypt it back to test.enc and delete it (test.txt).
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;

int main(){
        char pass[30];
        string site;
        getline(cin, site);
        cin &gt;&gt; pass;
        system(&quot;cd /opt/PW/ &amp;&amp; openssl enc -aes-256-ecb -d -iter 100000 -in test.enc -out test.txt&quot;);
        ofstream MyFile(&quot;/opt/PW/test.txt&quot;, ios::app);
        MyFile &lt;&lt; pass &lt;&lt; &quot;:&quot; &lt;&lt; site &lt;&lt; endl;
        MyFile.close();
        system(&quot;cd /opt/PW/ &amp;&amp; openssl enc -aes-256-ecb -iter 100000 -in test.txt -out test.enc &amp;&amp; rm -rf test.txt&quot;);
}

It's for personal use only.
I am curious to know how it can be exploited.
Avoid calling system()
If possible, avoid calling system(). There are almost always issues doing this:

It is slow: system() will spawn another shell, which has to parse the command line you give it, and then it will spawn the actual commands you want to run).
Constructing a command line itself has all kinds of issues. For example, are you sure openssl is in your $PATH? And what if the search path finds a different version of openssl than the one you expected (/usr/bin/openssl)?
There is no easy way to send and receive data to the commands you start, so you have to redirect the input/output to files.

Especially the latter issue is important: what if someone reads /opt/PW/test.txt between the two calls to system()?
It would be much better to use a crypto library. OpenSSL is not just a program, it's also a library that you can call directly from C. However, I would say it is not the easiest to work with. There are other libraries out there that make encrypting and decrypting files easier and safer, for example NaCL.
Cryptography is hard to get right
Trying to learn about cryptography is great! However, be aware that it is not easy to get cryptography right. You are using AES-256 in ECB mode, which is bad. Furthermore, you are not using any form of message authentication, so if someone tampers with the encrypted file, then even if they cannot decrypt it properly, when you try to decrypt it you will not get the same data back as you put it. Sometimes it will be obviously garbage, but it sometimes is possible to change the data in more subtle ways (especially with ECB mode, but other modes also have issues if not combined with a MAC).
Go ahead and try to improve your program, learn more about cryptography, but I strongly suggest you do not use your cryptographic code for anything serious until you get a much better understanding of cryptography.