Author Topic: io_crypt - encrypt your photos while you shoot them  (Read 53961 times)

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3031
  • 5D3 / M1 / 7D / 70D / SL1
Re: io_crypt - encrypt your photos while you shoot them
« Reply #100 on: December 31, 2016, 08:47:56 AM »
Interesting comparisons @g3gg0!
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101

stiefel40k

  • New to the forum
  • *
  • Posts: 5
Re: io_crypt - encrypt your photos while you shoot them
« Reply #101 on: March 16, 2017, 11:50:08 AM »
with ChaCha20 i get ~4.5 - 4.8 MiB/s
with XTEA its ~0.8 MiB/s
with LFSR it was ~20MiB/s (iirc)

Could you somewhere share your code with ChaCha20? I would like to check it out, because we (my friend and I) are doing a project where we would like to implement exactly this feature for magic lantern (with Poly1305).

Thanks in advance!
Regards,
Stiefel

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3040
Re: io_crypt - encrypt your photos while you shoot them
« Reply #102 on: March 19, 2017, 01:15:31 AM »
well, i don't think i kept it somewhere.
but it was quite simple to integrate.
i used the implementation from insanecoder (http://chacha20.insanecoding.org/)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

stiefel40k

  • New to the forum
  • *
  • Posts: 5
Re: io_crypt - encrypt your photos while you shoot them
« Reply #103 on: March 23, 2017, 02:45:50 PM »
So we tried to get up and running the io_crypt module, but we encountered some problems with the decryption.

(Our "specs":
Camera: 600D
Platform build: https://builds.magiclantern.fm/jenkins/job/600D.102/387/artifact/platform/600D.102/magiclantern-Nightly.2017Mar12.600D102.zip
io_crypt build: https://builds.magiclantern.fm/jenkins/job/io_crypt/2/artifact/modules/io_crypt/io_crypt.mo)

The encryption seems to be working, however we have some difficulties with the decryption. The camera itself can't decrypt the images in preview mode either. Regardless of what mode (RSA or PWD) we use. We have the same issue on a PC. Either we get a CR2 file which is just green or we get a JPG with various errors. One example: https://drive.google.com/drive/folders/0B6HUB6hIMVcRLWJubVZTNUxhOW8 I also included the Private key, for testing purposes.

Can somebody give us a hint what we are doing wrong? I also include the decrypt-executable which we use. (It was built by ourselves. See the drive link.)

Thanks in advance!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3040
Re: io_crypt - encrypt your photos while you shoot them
« Reply #104 on: April 08, 2017, 10:48:50 PM »
hi stiefel,
what were the exact settings you used?

i found the patch i used to add ChaCha20 support.
the file is a .patch, just renamed to .txt as the forum didnt allow this extension.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

bpv5P

  • Member
  • ***
  • Posts: 113
Re: io_crypt - encrypt your photos while you shoot them
« Reply #105 on: April 09, 2017, 02:18:19 PM »
Hi g3gg0, thanks for the work.
Have yourself implemented the crypto primitives? I didn't read the thread but, if that's the case, wouldn't be good to use something like libsodium[1] to do it?
Also, deniable encryption is a good idea. For example, you set two passwords, one for the real photos, other for a bunch of meaningless photos. So, if I'm a photojournalist working in some protest and authorities come telling me to show the pictures I can just put the fake password and be safe, kinda like the old Rubberhose file system.
Steganography could be a good project too... just exposing some ideas.



[1] https://libsodium.org

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3040
Re: io_crypt - encrypt your photos while you shoot them
« Reply #106 on: April 09, 2017, 03:41:08 PM »
to get proper encryption in camera, it requires *fast* algorithms and seamless integration.
first point was to figure out the capabilities and how to integrate encryption.

the latter point was already mentioned and is a good addition.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

stiefel40k

  • New to the forum
  • *
  • Posts: 5
Re: io_crypt - encrypt your photos while you shoot them
« Reply #107 on: April 12, 2017, 10:42:10 AM »
Hi g3gg0,

what were the exact settings you used?

The easiest way to show the exact options, we made a video about it: https://youtu.be/VwA3yAJTVY8 (you might have to wait, depending on when you check it out, because I just uploaded it, and it might take some time for youtube to process it).


i found the patch i used to add ChaCha20 support.
the file is a .patch, just renamed to .txt as the forum didnt allow this extension.

Thanks for it! It is very nice of you!

bpv5P

  • Member
  • ***
  • Posts: 113
Re: io_crypt - encrypt your photos while you shoot them
« Reply #108 on: August 08, 2017, 09:00:09 AM »
Hey @g3gg0 , check this out:
https://github.com/boyska/chdkripto

Seems interesting. It seems to use Curve25519 (as it's listed on IANIX page).
Also, for benchmarks:
https://bench.cr.yp.to/supercop.html

The research on in-camera encryption seems really interesting for forensics and could have a real impact as evidence for legal judgements.
Do you know if default Canon CR2 provide a reliable timestamp? If not, would ML silent_pic be able to write a DNG with encrypted timestamps?
Just some ideas.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3040
Re: io_crypt - encrypt your photos while you shoot them
« Reply #109 on: August 08, 2017, 04:58:01 PM »
hi bpv5P,

the encryption causes writing speed to go drastically down.
a simple repeaing XOR key which is not even halway safe, causes a drop in write speed by factor 2 or so?
so any real cipher makes life really hard :(

possible - but practical?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

bpv5P

  • Member
  • ***
  • Posts: 113
Re: io_crypt - encrypt your photos while you shoot them
« Reply #110 on: August 10, 2017, 06:00:50 AM »
hi bpv5P,

the encryption causes writing speed to go drastically down.
a simple repeaing XOR key which is not even halway safe, causes a drop in write speed by factor 2 or so?
so any real cipher makes life really hard :(

possible - but practical?

Yeah, I don't know the solution. 
Here's another idea: get the camera "MAC address" (I don't know if it's called that way on such devices), and encrypt the DNG metadata using it. It could be useful for legal usage, so you can autheticate the image. RAW image alone is used today as legal evidence, but it can be easily edited with the right tools, preserving metadata.

Although the idea above could be useful for some people, it will not be worth for journalists, for example, since anyone could see and delete the picture.
Another solution could be use homomorphic encryption on Wifi cameras:
https://tfhe.github.io/tfhe/

Or maybe to encrypt the whole filesystem with Chacha20, that's a faster algorithm than most of the ciphers...

I don't understand all of these concepts, though, I'm just leaving some links in case you have time and will to research...