2 * etl_add_passphrase_key_to_keyring: C bindings for libecryptfs's
3 * ecryptfs_add_passphrase_key_to_keyring() function
4 * Author: Tyler Hicks <tyhicks@canonical.com>
6 * Copyright (C) 2012 Canonical, Ltd.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include "../../src/include/ecryptfs.h"
28 int main(int argc, char *argv[])
30 char auth_tok_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1];
31 char salt[ECRYPTFS_SALT_SIZE + 1];
35 fprintf(stderr, "%s PASSPHRASE SALT_HEX\n", argv[0]);
39 rc = ecryptfs_validate_keyring();
43 from_hex(salt, argv[2], ECRYPTFS_SALT_SIZE);
44 rc = ecryptfs_add_passphrase_key_to_keyring(auth_tok_sig_hex, argv[1],
46 /* If the key is already added to the keyring, 1 is returned */
50 printf("%s\n", auth_tok_sig_hex);