Skip to contentSkip to conversation

Encrypting DVD or CDROM from iso

dm-crypt Davide Marchi 4 participants 6 messages Nov 10, 2020 – Nov 12, 2020

lore
Share & tools
lore
#0 lore raw

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt. I've followed this tutorial, with no luck: http://www.sourcentral.org/luks/iso9660/

and the DVD or cdrom created cannot be activated:

    cryptsetup --debug -r luksOpen /dev/sr1 dvdati
    # cryptsetup 2.0.2 processing "cryptsetup --debug -r luksOpen 

/dev/sr1 dvdati"
# Running command open.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device /dev/sr1.
# Trying to open and read device /dev/sr1 with direct-io. # Initialising device-mapper backend library.
# Trying to load any crypt type from device /dev/sr1. # Crypto backend (gcrypt 1.8.1) initialized in cryptsetup library
version 2.0.2.

    # Detected kernel Linux 5.3.1-050301-lowlatency x86_64.
    # PBKDF pbkdf2, hash sha256, time_ms 2000 (iterations 0), 

max_memory_kb 0, parallel_threads 0.
# Reading LUKS header of size 1024 from device /dev/sr1 # Key length 32, device size 2097151 sectors, header size 2050
sectors.

    # Activating volume dvdati using token -1.
    # Interactive passphrase entry requested.
    Inserire la passphrase per /dev/sr1:
    # Activating volume dvdati [keyslot -1] using passphrase.
    # dm version   [ opencount flush ]   [16384] (*1)
    # dm versions   [ opencount flush ]   [16384] (*1)
    # Detected dm-ioctl version 4.40.0.
    # Detected dm-crypt version 1.19.0.
    # Device-mapper backend running with UDEV support enabled.
    # dm status dvdati  [ opencount flush ]   [16384] (*1)
    # Trying to open key slot 0 [ACTIVE_LAST].
    # Reading key slot 0 area.
    # Using userspace crypto wrapper to access keyslot area.
    Slot di chiave 0 sbloccato.
    # Calculated device size is 2093055 sectors (RW), offset 4096.
    # DM-UUID is CRYPT-LUKS1-fc00404de1784730ae9492929a0db06c-dvdati
    # Udev cookie 0xd4d0652 (semid 10) created
    # Udev cookie 0xd4d0652 (semid 10) incremented to 1
    # Udev cookie 0xd4d0652 (semid 10) incremented to 2
    # Udev cookie 0xd4d0652 (semid 10) assigned to CREATE task(0) with 
flags DISABLE_LIBRARY_FALLBACK         (0x20)
    # dm create dvdati 
CRYPT-LUKS1-fc00404de1784730ae9492929a0db06c-dvdati [ opencount flush ]  
 [16384] (*1)
    # dm reload dvdati  [ opencount flush readonly securedata ]   
[16384] (*1)
    device-mapper: reload ioctl on   failed: Argomento non valido
    # Udev cookie 0xd4d0652 (semid 10) decremented to 1
    # Udev cookie 0xd4d0652 (semid 10) incremented to 2
    # Udev cookie 0xd4d0652 (semid 10) assigned to REMOVE task(2) with 
flags DISABLE_LIBRARY_FALLBACK         (0x20)
    # dm remove dvdati  [ opencount flush readonly securedata ]   
[16384] (*1)
    # Udev cookie 0xd4d0652 (semid 10) decremented to 1
    # Udev cookie 0xd4d0652 (semid 10) waiting for zero
    # Udev cookie 0xd4d0652 (semid 10) destroyed
    # Releasing crypt device /dev/sr1 context.
    # Releasing device-mapper backend.
    # Unlocking memory.
    Comando non riuscito con codice -1 (parametri errati o mancanti).

and also the iso not dockable to the loopback device:

#cryptsetup -r luksOpen /dev/loop20 volume1
#The required offset is beyond the actual size of the /dev/loop20
device

Could you give me a tips for make it working?

Many thanks!

Davide

#1 lore raw
Quoted 6 lines · Davide Marchi

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt. I've followed this tutorial, with no luck:
http://www.sourcentral.org/luks/iso9660/

Quoted 6 lines

and the DVD or cdrom created cannot be activated:

      cryptsetup --debug -r luksOpen /dev/sr1 dvdati
      # cryptsetup 2.0.2 processing "cryptsetup --debug -r luksOpen

Hi,

could you try to reproduce it on more up to date cryptsetup release? Version 2.0.2 is quite old and may contain bugs already fixed in current upstream.

Regards O.

Quoted 84 lines

/dev/sr1 dvdati"
# Running command open.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device /dev/sr1.
# Trying to open and read device /dev/sr1 with direct-io. # Initialising device-mapper backend library.
# Trying to load any crypt type from device /dev/sr1. # Crypto backend (gcrypt 1.8.1) initialized in cryptsetup library
version 2.0.2.

      # Detected kernel Linux 5.3.1-050301-lowlatency x86_64.
      # PBKDF pbkdf2, hash sha256, time_ms 2000 (iterations 0),

max_memory_kb 0, parallel_threads 0.
# Reading LUKS header of size 1024 from device /dev/sr1 # Key length 32, device size 2097151 sectors, header size 2050
sectors.

      # Activating volume dvdati using token -1.
      # Interactive passphrase entry requested.
      Inserire la passphrase per /dev/sr1:
      # Activating volume dvdati [keyslot -1] using passphrase.
      # dm version   [ opencount flush ]   [16384] (*1)
      # dm versions   [ opencount flush ]   [16384] (*1)
      # Detected dm-ioctl version 4.40.0.
      # Detected dm-crypt version 1.19.0.
      # Device-mapper backend running with UDEV support enabled.
      # dm status dvdati  [ opencount flush ]   [16384] (*1)
      # Trying to open key slot 0 [ACTIVE_LAST].
      # Reading key slot 0 area.
      # Using userspace crypto wrapper to access keyslot area.
      Slot di chiave 0 sbloccato.
      # Calculated device size is 2093055 sectors (RW), offset 4096.
      # DM-UUID is CRYPT-LUKS1-fc00404de1784730ae9492929a0db06c-dvdati
      # Udev cookie 0xd4d0652 (semid 10) created
      # Udev cookie 0xd4d0652 (semid 10) incremented to 1
      # Udev cookie 0xd4d0652 (semid 10) incremented to 2
      # Udev cookie 0xd4d0652 (semid 10) assigned to CREATE task(0) with
flags DISABLE_LIBRARY_FALLBACK         (0x20)
      # dm create dvdati
CRYPT-LUKS1-fc00404de1784730ae9492929a0db06c-dvdati [ opencount flush ]
   [16384] (*1)
      # dm reload dvdati  [ opencount flush readonly securedata ]
[16384] (*1)
      device-mapper: reload ioctl on   failed: Argomento non valido
      # Udev cookie 0xd4d0652 (semid 10) decremented to 1
      # Udev cookie 0xd4d0652 (semid 10) incremented to 2
      # Udev cookie 0xd4d0652 (semid 10) assigned to REMOVE task(2) with
flags DISABLE_LIBRARY_FALLBACK         (0x20)
      # dm remove dvdati  [ opencount flush readonly securedata ]
[16384] (*1)
      # Udev cookie 0xd4d0652 (semid 10) decremented to 1
      # Udev cookie 0xd4d0652 (semid 10) waiting for zero
      # Udev cookie 0xd4d0652 (semid 10) destroyed
      # Releasing crypt device /dev/sr1 context.
      # Releasing device-mapper backend.
      # Unlocking memory.
      Comando non riuscito con codice -1 (parametri errati o mancanti).

and also the iso not dockable to the loopback device:

#cryptsetup -r luksOpen /dev/loop20 volume1
#The required offset is beyond the actual size of the /dev/loop20
device

Could you give me a tips for make it working?

Many thanks!

Davide

_______________________________________________
dm-crypt mailing list
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt

#2 lore raw
In reply to Davide Marchi
Quoted 6 lines · Davide Marchi

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt. I've followed this tutorial, with no luck: http://www.sourcentral.org/luks/iso9660/

and the DVD or cdrom created cannot be activated:

Hum. I created encrypted DVD years ago with a similar procedure, somewhat simpler. Basically, I created an empty file of the same size as the CD or DVD, mounted it as a loop device, then I encrypted that loop device, and then I formatted the resulting luks device with any filesystem type I wished, typically XFS.

This, so far, still works.

Then I just burn that file to DVD.

The final step is to mount and decipher the DVD - and this step failed, but it was an XFS error if I remember correctly.

I can fish out the precise instructions if you are interested, and find out the actual error. I have a bugzilla stuck on it.

Signature · 4 lines
Cheers / Saludos,

		Carlos E. R.
		(from 15.1 x86_64 at Telcontar)
#3 lore raw
Quoted 15 lines · Carlos E. R.
Quoted 7 lines · Davide Marchi

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt. I've followed this tutorial, with no luck:
http://www.sourcentral.org/luks/iso9660/

and the DVD or cdrom created cannot be activated:

Hum. I created encrypted DVD years ago with a similar procedure, somewhat simpler. Basically, I created an empty file of the same size as the CD or DVD, mounted it as a loop device, then I encrypted that loop device, and then I formatted the resulting luks device with any filesystem type I wished, typically XFS.

Quoted 6 lines

This, so far, still works.

Then I just burn that file to DVD.

The final step is to mount and decipher the DVD - and this step failed, but it was an XFS error if I remember correctly.

You cannot switch block size in XFS - if DVD reports 2k block and XFS was formatted with 4k block device, it will never work.

This is not a cryptsetup problem but the way how XFS works.

Try to run lsblk -t and compare reported sector size for DVD device and your original device. If it is the same, it should work even for XFS.

Milan

#4 lore raw
Quoted 18 lines · Milan Broz
Quoted 17 lines · Carlos E. R.
Quoted 7 lines · Davide Marchi

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt. I've followed this tutorial, with no luck:
http://www.sourcentral.org/luks/iso9660/

and the DVD or cdrom created cannot be activated:

Hum. I created encrypted DVD years ago with a similar procedure, somewhat simpler. Basically, I created an empty file of the same size as the CD or DVD, mounted it as a loop device, then I encrypted that loop device, and then I formatted the resulting luks device with any filesystem type I wished, typically XFS.

This, so far, still works.

Quoted 7 lines
Quoted 4 lines

Then I just burn that file to DVD.

The final step is to mount and decipher the DVD - and this step failed, but it was an XFS error if I remember correctly.

You cannot switch block size in XFS - if DVD reports 2k block and XFS was formatted with 4k block device, it will never work.

It worked several years ago, I have dozens of DVDs made this way.

Quoted 4 lines

This is not a cryptsetup problem but the way how XFS works.

Try to run lsblk -t and compare reported sector size for DVD device and your original device. If it is the same, it should work even for XFS.

Signature · 4 lines
Cheers / Saludos,

		Carlos E. R.
		(from 15.1 x86_64 at Telcontar)
#5 lore raw
In reply to Davide Marchi
Quoted 7 lines · Davide Marchi

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt. I've followed this tutorial, with no luck:
http://www.sourcentral.org/luks/iso9660/

and the DVD or cdrom created cannot be activated:

...

Quoted 11 lines

Comando non riuscito con codice -1 (parametri errati o mancanti).

and also the iso not dockable to the loopback device:

#cryptsetup -r luksOpen /dev/loop20 volume1
#The required offset is beyond the actual size of the /dev/loop20
device

Could you give me a tips for make it working?

While the page you linked is quite old, it still works (I tried 2.0.2 version even). (Loop devices are now allocated automatically, no need to use losetup with cryptsetup, just use file as the argument. THe size calculation is too tricky there, it can be simplified.).

Are you sure that your *.iso image was correctly created? It seems to me that it is just LUKS header without data (that's why "beyond offset" error).

Milan