I want to decrypt and mount the default eCryptfs private directory by executing the "ecryptfs-mount-private" terminal command in C++ and providing the passphrase/password from the same C++ script.
I have tried forking then exec the shell (/bin/sh) and opening pipes for I/O with sh but when I try to write through the pipe I get the following error:
stty: standard input: Inappropriate ioctl for device
I guess this is because ecryptfs-mount-private only accepts input for a passphrase from the keyboard.
How can I achieve this type of decrypt and mount mechanism? Possible ways of doing this or any workarounds will be helpful.
PS. Security concern of storing the passphrase in the C++ code is not a problem in my scenario.