DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Police Terror <PoliceTerror@dyne.org>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] cryptsetup with Python subprocess + pipes
Date: Fri, 24 Jun 2016 09:56:11 +0000	[thread overview]
Message-ID: <576D03BB.9010301@dyne.org> (raw)
In-Reply-To: <94146e8c-438a-85b5-0f29-ce02642af1ee@gmail.com>

Ahhh yes! Thank you Diagon and Milan.
I've added now the -q switch.

I looked at the pycryptsetup but 2 things:

1. It's not Python 3
2. It's an extra dependency and not in the repos.

Milan Broz:
> On 06/23/2016 11:37 PM, Police Terror wrote:
>> Hello,
>>
>> I'm trying to make a plausible deniability encryption wrapper around
>> cryptsetup.
>>
>> Basically it uses a hash table to first lookup an offset (encrypted with
>> the password), then uses that offset to load a hidden volume within a
>> contiguous file (within which other volumes may or may not exist).
>>
>> The theory is solid, and everything is mostly working. The only problem
>> I'm having is doing the communication in Python:
>>
>>     # Format the volume
>>     pipe = subprocess.Popen(["cryptsetup", "luksFormat", loop_device],
>>                             stdout=subprocess.PIPE,
>>                             stdin=subprocess.PIPE)
>>     out = pipe.communicate(input=b"YES\n" + password)
>>     if pipe.returncode:
>>         error("Problem formatting volume.")
>>         return pipe.returncode
>>
>> For some reason, this does not give any output! But the volume gets
>> created, but I cannot decrypt it with the password.
> 
> Probably because if you use pipe, cryptsetup will switch to batch
> mode where there is no question and no output.
> 
> It is better to add batch mode (-q switch) explicitly and remove from
> "YES\n" from your script (otherwise it becomes password ;-).
> 
> There is also simple Python pycryptsetup wrapper (it doesn't cover all
> commands though).
> 
> Milan
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
> 

  reply	other threads:[~2016-06-24  9:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 21:37 [dm-crypt] cryptsetup with Python subprocess + pipes Police Terror
2016-06-24  5:42 ` [dm-crypt] cryptsetup with Python subprocess + pipes (saout: to exclusive) Diagon
2016-06-24  9:58   ` Police Terror
2016-06-24  5:42 ` [dm-crypt] cryptsetup with Python subprocess + pipes Milan Broz
2016-06-24  9:56   ` Police Terror [this message]
2016-06-24 10:45     ` Milan Broz
2016-06-24 12:16       ` Police Terror
2016-06-24 15:28         ` Arno Wagner
2016-06-24 16:33           ` Police Terror
2016-06-24 16:58             ` Arno Wagner
2016-06-29  0:02               ` Arno Wagner
2016-06-29  8:47                 ` Police Terror
2016-06-29  9:58                   ` Arno Wagner
2016-06-29 11:47                     ` Police Terror
2016-06-29 17:28                       ` Arno Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576D03BB.9010301@dyne.org \
    --to=policeterror@dyne.org \
    --cc=dm-crypt@saout.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox