How do i encrypt and decrypt a file using the openssl aes-256-cbc cipher?



  • Man page for openssl enc

        -pbkdf2
               Use PBKDF2 algorithm with default iteration count unless otherwise
               specified.
    

    To encrypt.

    $ openssl enc -aes-256-cbc -pbkdf2 -in /tmp/sample_file  -out /tmp/sample_file.dat
    enter aes-256-cbc encryption password:
    Verifying - enter aes-256-cbc encryption password:
    $
    
    $ file /tmp/sample_file.dat
    sample_file.dat: data
    

    To decrypt.

    $ openssl enc -aes-256-cbc -pbkdf2 -d -in sample_file.dat > sample_file.txt
    enter aes-256-cbc decryption password:
    $
    
    $ file /tmp/sample_file.txt
    sample_file.txt: ASCII text
    

Log in to reply
 

© Lightnetics 2024