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!
Roughly speaking what I really seek is to encrypt the USB stick itself, not some file inside it.
– Evandro Silva
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.
– cantoni
@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
– Evandro Silva