You should use a symmetric encryption algorithm (like aes or twofish) that uses the same key (password) to encrypt/decrypt the data.
Crypto++[
^] is a very popular library, an I also recommend
LibTomCrypt[
^] that has very nice clean source even for learning purposes.