2
* Copyright (C) 2007 International Business Machines
3
* Author(s): Michael Halcrow <mhalcrow@us.ibm.com>
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29
"ecryptfs_unwrap_passphrase [file] [wrapping passphrase]\n"
33
int main(int argc, char *argv[])
36
char passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 1];
37
char *wrapping_passphrase;
38
char salt[ECRYPTFS_SALT_SIZE];
39
char salt_hex[ECRYPTFS_SALT_SIZE_HEX];
47
wrapping_passphrase = argv[2];
48
rc = ecryptfs_read_salt_hex_from_rc(salt_hex);
50
printf("Unable to read salt value from user's "
51
".ecryptfsrc file; using default\n");
52
from_hex(salt, ECRYPTFS_DEFAULT_SALT_HEX, ECRYPTFS_SALT_SIZE);
54
from_hex(salt, salt_hex, ECRYPTFS_SALT_SIZE);
55
if ((rc = ecryptfs_unwrap_passphrase(passphrase, file,
56
wrapping_passphrase, salt))) {
57
printf("Error attempting to unwrap passphrase; rc = [%d]. "
58
"Check the system log for more information from "
59
"libecryptfs.\n", rc);
63
printf("%s", passphrase);