I am trying to mount an fs with ecryptfs in a program in C. But I don't manage to give to the kernel part the key
int mount_crypt(char* source)
{
int r = -1;
char opt[1024] = "ecryptfs_sig=f83de0de4ecccbb1,ecryptfs_cipher=aes,ecryptfs_key_bytes=16";
r = mount(source, source, "ecryptfs", MS_MGC_VAL, opt);
if (r != 0)
{
perror("EErrr mount cry");
printf("Error mount cry: %d\n", r);
}
return (r);
}
In /var/log/messages :
process_request_key_err: No key
One or more global auth toks could not properly register; rc = [-2]
I try with this in the opt string :
key=passphrase:passphrase_passwd=MYPASSS
but It doesn't work
with :
int icloud_mount_crypt(char* source)
{
int r = -1;
char opt[1024] = "key=passphrase:passphrase_passwd=XXXXXX,ecryptfs_sig=f83de0de4ecccbb1,ecryptfs_cipher=aes,ecryptfs_key_bytes=16";
r = mount(source, source, "ecryptfs", MS_MGC_VAL, opt);
if (r != 0)
{
perror("EErrr mount cry");
printf("Error mount cry: %d\n", r);
}
return (r);
}
Here the log :
Feb 15 11:15:41 nightmare kernel: [2847133.493005] ecryptfs_parse_options: eCryptfs: unrecognized option [key=passphrase:passphrase_passwd=XXXXXX]
Feb 15 11:15:41 nightmare kernel: [2847133.493022] Could not find key with description: [f83de0de4ecccbb1]
Feb 15 11:15:41 nightmare kernel: [2847133.493028] process_request_key_err: No key
Feb 15 11:15:41 nightmare kernel: [2847133.493032] Could not find valid key in user session keyring for sig specified in mount option: [f83de0de4ecccbb1]
Feb 15 11:15:41 nightmare kernel: [2847133.493035] One or more global auth toks could not properly register; rc = [-2]
Feb 15 11:15:41 nightmare kernel: [2847133.493039] Error parsing options; rc = [-2]
Thanks for help