1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Crypting private data

Discussion in 'Userland Programming & Scripting' started by valsorym, Dec 4, 2011.

  1. valsorym

    valsorym New Member

    Messages:
    419
    Likes Received:
    0
    Howdy all,
    probably each of us has private data (credit card Pin-code, account in email or host server/ssh/root password, in the end phone number Jasmin of erotic escort service :r).

    In the past (when I used the WIndows OS) I wrote for me a small program encryption of text data using the method of public keys. It was a good program. I used it and after the transition to FreeBSD, using the true emulators/wine tool. All these I have kept on an external hard drive - which soon failed (broken). Now I've lost the source code, software and personal data. (To say there is nothing - a loser).

    I now have a question - is it worth to rewrite the program again? Or may have a similar under FreeBSD? How are you hiding from the wife of the phone a your girl friend? :) (sorry, ... your personal data).

    * I've seen a lot of programs - but ruled that the issue for discussion because it "delicate". I would like to do would have been encrypted data securely and the program not was "trojan" (do not send my passwords to developer).

    What would you recommend? (* It is desirable for the console).
    Thanks.
     
  2. fonz

    fonz Moderator Staff Member Moderator

    Messages:
    2,435
    Likes Received:
    5
    FreeBSD offers plenty of encryption facilities: for single files, for partitions or even the entire system.

    Fonz
     
  3. aragon

    aragon New Member

    Messages:
    2,031
    Likes Received:
    0
  4. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,359
    Likes Received:
    0
  5. graudeejs

    graudeejs Member

    Messages:
    4,594
    Likes Received:
    0
  6. fluca1978

    fluca1978 New Member

    Messages:
    733
    Likes Received:
    0
    I've tried truecrypt on 9 rc1 over an usb fat32 filesystem and it seems working.
     
  7. folivora

    folivora New Member

    Messages:
    100
    Likes Received:
    0
    I am using geli with md to create small crypted partitions.

    Works nicely.
     
  8. fonz

    fonz Moderator Staff Member Moderator

    Messages:
    2,435
    Likes Received:
    5
    +1 for geli(8).

    You can do pretty much anything from creating small encrypted partitions to encrypting the entire system including / and swap.

    The handbook has a section on geli (and gbde), but it focuses on encrypting an actual disk partition. For full system encryption search the HOWTO forum; several people have written HOWTOs for this, including The User Formerly Known As Killasmurf. For creating a small encrypted partition contained in a file (similar to a TrueCrypt container) you may want to use geli in conjunction with md(4) as already said by several people. There might be a HOWTO for that too, but don't shoot me if there isn't one (yet).

    Fonz
     
  9. bes

    bes New Member

    Messages:
    95
    Likes Received:
    0
  10. valsorym

    valsorym New Member

    Messages:
    419
    Likes Received:
    0
    Hi guys.
    It's me, again, and it's my solution this problem (yep tool).
    Sorry that I do not listen to all of you, but I think easier to create my solution, than learn other programs.

    Note:
    1. It only works with Latin alphabet.
    2. The program completely fresh - has not yet been tested.


    Okay, no big program that allows you to encrypt text files are not very complicated, but rather a reliable method.

    In order to create/open an encrypted file, simply run:
    % yep <TEXTEDITOR> <FILENAME>
    For example:
    % yep vim ~/my_first_yep_file

    * Use the argument of -w to ask your protection key.
    For example:
    % yep -w doorways vim ~/my_second_yepfile

    To get help:
    % yep -i

    To change the password and the keyword:
    % yep -p ~/yepfile
    or
    % yep -w my_keyword -p ~/yepfile

    During operation, the program will create a directory / tmp / yep that will host the temporary files. For that to change this directory, use the argument of -d [/ i].
    For example:
    % yep -w doorways -d ~/tmp/ vim ~/yepfile

    Directory structure:
    Code:
     ~/yep/
          |__ bin/
          |__ doc/
          |__ src/
          |__ ..
          |__ .
    
    Sources:
    ~/yep/src/yep.c
    The full source code with syntax highlighting can be viewed here!

    ~/yep/src/Makefile
    Code:
    # Project:          yep
    # Date created:     April 22, 2012
    # Whom:             valsorym <valsorym.e@gamil.com>
    
    # binary
    EXECUTABLE = $(.CURDIR)/../bin/yep
    
    # compiler
    CC = cc
    CFLAGS = -Wall -std=c99 
    LDFLAGS = -O2
    
    # targets
    all: $(EXECUTABLE)
    $(EXECUTABLE): yep.o
    	$(CC) $(CFLAGS) -o $@ $> $(LDFLAGS) 
    
    yep.o: yep.c
    	$(CC) $(CFLAGS) -c $>
    
    .PHONY: all clean run install
    
    clean:
    	rm -f *.out *.o *.core
    
    run:
    	$(EXECUTABLE)
    
    install:
    	cp $(EXECUTABLE) ./bin/
    
    P.S. I hope this helps someone too. (It helped you - tell me "thank you". It is not helped - I listen to your criticism! :) ).
    P.P.S. No need to yell at me, I know that to create a bike again - bad! But I want to ..!
     
  11. DutchDaemon

    DutchDaemon Administrator Staff Member Administrator Moderator

    Messages:
    10,622
    Likes Received:
    2
    Large amounts of output really belong on something like http://pastebin.com, which will give you a link you can post here.. It's in the forum guidelines.
     
  12. bes

    bes New Member

    Messages:
    95
    Likes Received:
    0
    If you just want to edit a text file, you can add Password Protection to a file your editing in vim:
    [CMD="vim"]-x <FILENAME>[/CMD]
     
  13. valsorym

    valsorym New Member

    Messages:
    419
    Likes Received:
    0

    Yes, you are right!
    But this is just vim editor, but if I will need to use: vi/ee (FreeBSD default editors), emacs, nano (Linux Gentoo default editor) ... etc. I can create yepfile on FreeBSD, for example, use vim
    % yep -w doorways vim ~/my_yepfile

    and then read (edit) it use nano in my Linux Gentoo
    % yep -w doorways nano ~/my_yepfile

    So, I can use any others text editors.

    But, thank you! I didn't know this about vim :r
     
  14. valsorym

    valsorym New Member

    Messages:
    419
    Likes Received:
    0
    Oh, thanks! This is very interesting.
    Now the full source code with syntax highlighting can be viewed here!