Encrypting local files in Solaris


How do I encrypt local file in Solaris ? On Linux I use either OpenSSL or GPG but these are both open source projects not native in the Solaris land. For this Solaris has encrypt/decrypt tools which do what their name say. And of course we talk here about symmetric encryption. Options for encrypt/decrypt are succinct – list available algorithms, specify input/output file(s), and optional specify file containing the key or otherwise type it on terminal. Few examples are to follow.

  • List algos

# encrypt –l

    Algorithm       Keysize:  Min   Max (bits)
    ------------------------------------------
    aes                       128   256
    arcfour                     8  2048
    des                        64    64
    3des                      192   192
  • Now let’s encrypt something (file smtp_send.py ) with AES algorithm.

# encrypt -a aes -i smtp_send.py -o smtp_send.py.enc
Enter key:

# file smtp_send.py.enc

    smtp_send.py.enc:       data
  • And what about decrypting ?

# decrypt -a aes -i smtp_send.py.enc -o smtp_send.py.dec
Enter key:

  • In case you wish to use key stored in a file (I personally don’t do it as it is too easy to forget to delete the key file).

# encrypt -a aes –k key_in_a_file.txt -i smtp_send.py -o smtp_send.py.enc