It sounds like you are using Vi as your editor (:x
is a bit of a give-away). From this page:
Crypt
Open the file using vi, type :XEnter, enter the key (this key will be the password to see the crypted file) and then save and exit with :wqEnter.
The file will be crypted.
You can use:
vi -x yourfile
to do the same thing.
Decrypt
To decrypt just the way you encrypted the file.
Open the file using vi, type :XEnter, enter the key and after that the file will be visible and writable. If you close and save your file by :wqEnter the file will be still crypted.
solved How to decrypt the c program?