Results 1 to 9 of 9

Thread: Encrypt tar files during the tar

  1. #1
    Join Date
    Nov 2008
    Location
    Swiss
    Beans
    247
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Encrypt tar files during the tar

    Hi!

    I want to know if it is possible to encrypt a file with a password during the tar. Such than when I tar something (like a backup of my system) I do it at night and I don't need to encrypted after it is done.

    Thanks in advance

  2. #2
    Join Date
    Aug 2008
    Location
    Washington DC
    Beans
    2,186
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Encrypt tar files during the tar

    last time I checked tar had no capacity to encrypt itself.

    It's easy enough to encrypt any file (including a tar)

    see: http://snippets.dzone.com/posts/show/341

  3. #3
    Join Date
    Nov 2008
    Location
    Swiss
    Beans
    247
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Encrypt tar files during the tar

    hummm ok. I tryed but gave me an error

    Bad magic number

    How do I set one?

  4. #4
    Join Date
    Aug 2008
    Location
    Washington DC
    Beans
    2,186
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Encrypt tar files during the tar

    encrypt:

    tar -c directory | openssl des3 -salt > encrypted.tarfile

    decrypt:

    cat encrypted.tarfile | openssl des3 -d -salt |tar -xv

  5. #5
    Join Date
    Nov 2008
    Location
    Swiss
    Beans
    247
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Encrypt tar files during the tar

    Very nice thanks. I have only one more question. What about size?? for a 40MB files is giving me 48MB and my goal is to use this with 150GB.

    I tryed to change the extensions but still the same. Any idea??

  6. #6
    Join Date
    Aug 2008
    Location
    Washington DC
    Beans
    2,186
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Encrypt tar files during the tar

    Just add the flag to use compression:

    encrypt:

    tar -cj directory | openssl des3 -salt > encrypted.tarfile

    decrypt:

    cat encrypted.tarfile | openssl des3 -d -salt |tar -xvj

  7. #7
    Join Date
    Nov 2008
    Location
    Swiss
    Beans
    247
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Encrypt tar files during the tar

    cool man. Thanks a lot. Can you give me you bank number? to make a donnation

  8. #8
    Join Date
    Nov 2007
    Location
    República de Tejas,Centro
    Beans
    232
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Encrypt tar files during the tar

    the -cj will give you better compression
    using -cz will run faster with a bit less compression

    But what does the "-salt" do? I'm not finding it in man openssl.
    Last edited by Skip Da Shu; June 18th, 2009 at 03:20 AM.
    - da shu @ HeliOS,
    "A child's exposure to technology should never be predicated on an ability to afford it."

  9. #9
    Join Date
    Nov 2009
    Location
    Portland, OR, USA
    Beans
    1

    Re: Encrypt tar files during the tar

    Old post, but here's what I found about -salt
    http://linux.die.net/man/1/enc

    The -salt option should ALWAYS be used if the key is being derived from a password unless you want compatibility with previous versions of OpenSSL and SSLeay.
    Without the -salt option it is possible to perform efficient dictionary attacks on the password and to attack stream cipher encrypted data. The reason for this is that without the salt the same password always generates the same encryption key. When the salt is being used the first eight bytes of the encrypted data are reserved for the salt: it is generated at random when encrypting a file and read from the encrypted file when it is decrypted.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •