How to encrypt a C-drive?

Asked

Viewed 146 times

3

First to locate them, I have an idea of security, and to be able to put this idea into practice I would need to learn how to encrypt a USB stick.

The idea is that the USB stick works as a 'key', and at the same time this USB stick cannot be easily accessed (so the encryption).

I could simply use Bitlocker, or several other programs for encryption. But my intention is that the flash drive cannot be accessed by any 'common' operating system. I want the pendrive to be accessed, solely and exclusively by my hardware (an Arduino for example (which I will also need to learn, but one thing at a time kk)).

I know little about cryptography, but if someone knows, if they’ve been through a similar situation and can help me, give me a direction, where to start etc.

Thank you!!

  • Roughly speaking what I really seek is to encrypt the USB stick itself, not some file inside it.

  • Encrypting the USB stick is not a problem. You can use LUKS for this (https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup). The problem is you can implement decryption in the Arduino. It has no computational power or libraries for this.

  • @Thank you very much, I understand your point. Maybe this is not the best solution so... I will take a little longer 'breaking my head' for this solution

1 answer

4

Here are some tips and suggestions:

1) It is not just because information cannot be read in an orthodox way (through common operating systems) that it is safe. This is called falsa sensação de segurança. The best way to protect your data is through encryption (and all the power of the mathematics behind it), once encrypted, no matter the medium or media in which this data will be trafficked, stored and/or copied, what matters is that to be decrypted would require a tremendous computational effort, a lot of time and/or a lot of money;

2) Basically, there are two distinct types of cryptographic algorithms using keys: the Simétrico and the Assimétrico. To simplify, I suggest using a symmetric key encryption algorithm. Currently, there are several such as: AES, Twofish, Serpent, Blowfish, CAST5, RC4, 3DES and/or IDEA, and it won’t be hard to find libraries in C capable of implementing them;

3) Your hardware can work smoothly using a standard filesystem, such as NTFS, and read and write files in a simple and uncomplicated way using Arduin hardware;

4) If the intention is to store the cryptographic key in the flash drive, I suggest she be protected by a PIN (Personal Identification Number), and this could also be done through symmetric key encryption, with an easy-to-memorize key. I suggest using a compression library (such as the zlib) capable of compressing and protecting data with a password, such as on credit cards with chip;

5) In systems *Nix, the flash drive is represented by a special file within the directory /dev. For example: /dev/sdb, /dev/sdc, etc. Such a file can be opened through the function open() while reading and writing the data can be done through the functions read() and write() respectively. Another alternative would be to use the function ioctl() for direct handling of the USB device.

References:

PIN: https://en.wikipedia.org/wiki/Personal_identification_number

Cryptography Symmetric: https://en.wikipedia.org/wiki/Symmetric-key_algorithm

Asymmetric Cryptography: https://en.wikipedia.org/wiki/Public-key_cryptography

Function: ioctl(): http://man7.org/linux/man-pages/man2/ioctl.2.html

Function: open(): http://man7.org/linux/man-pages/man2/open.2.html

I hope I’ve helped!

  • Thanks for the guidance, I’m gonna take a look at that stuff. However, what I seek is to encrypt the USB stick itself, not some file inside it.

  • @Evandrosilva: Following edition with the inclusion of item 5.

  • Hmmm interesting, I’ll take a look at this ioctl() function, maybe that’s what I’m looking for. Thanks for the material!

  • 1

    Great answer, @Lacobus! I would add that as the USB stick will be accessed only by Arduino, it would not be necessary a file system, although all allocation and reading management would have to be done manually. If Arduino supports encryption + file system, no problem. Otherwise, you can use the USB stick to record data in binary form (for records of fixed size, for example) without respecting a file system.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.