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
30
"ecryptfs-add-passphrase [passphrase]\n"
34
int main(int argc, char *argv[])
36
char passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH + 1];
37
char auth_tok_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1];
38
char salt[ECRYPTFS_SALT_SIZE];
39
char salt_hex[ECRYPTFS_SALT_SIZE_HEX];
46
memcpy(passphrase, argv[1], ECRYPTFS_MAX_PASSWORD_LENGTH);
47
passphrase[ECRYPTFS_MAX_PASSWORD_LENGTH] = '\0';
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_add_passphrase_key_to_keyring(auth_tok_sig_hex,
57
printf("Error attempting to insert passphrase "
58
"into the user session keyring; rc = [%d]. "
59
"Check the system log for more information from "
60
"libecryptfs.\n", rc);
64
auth_tok_sig_hex[ECRYPTFS_SIG_SIZE_HEX] = '\0';
65
printf("Inserted auth tok with sig [%s] into the user session "
66
"keyring\n", auth_tok_sig_hex);