KC(1)

NAME
kc - console based username and password management application

SYNOPSIS
kc [-k database file] [-r] [-p password file] [-m cipher mode] [-b] [-v] [-h]

DESCRIPTION
The kc utility is a console based username and password management application using an encrypted XML document as its database.

A database file can contain multiple keychains, and keychains in turn can contain multiple keys (usernames if you like) and values (passwords if you like).

After starting kc the help command shows the available commands, and usage information for them. If you're in a hurry, for starters, you create a new entry with the new command, then entering only a number in the command line will display the entry with the given index. You quit from the display with 'q' or EOT (usually CTRL+d).

The CLI supports tab-completion for commands and keychains.

There is a utility in the source package that converts an exported pwsafe database to a kc compatible XML database, which can be imported using the import command.

NOTE: Currently there is no character set conversion taking place in the program. You either input UTF-8 and be ready to display it, or you don't input anything other than US-ASCII. You would still be able to read the database after not UTF-8 nor US-ASCII (eg.: latin2) input, but not in the way you would expect it. You can "repair" such databases, by exporting (see the xport command below), converting the plain text XML file to UTF-8, then importing the database. (see the import command below).

  PARAMETERS

-k file
    Use file as database. The default is ~/.kc/default.

-r  Open the database in read only mode. kc will not try to lock the database file, and commands which could modify the database will not be available.

-p file
    Read password from file.

-m mode
    Cipher mode to use. mode can be one of 'cbc' (the default), 'cfb128' or 'ofb'. More information is in the CIPHERS section.

-b  Batch mode. Disable some features to enable commands from standard input.

-v  Display version.

-h  Display help.

  COMMANDS
These commands are available in the CLI:

new [name]
    Create a new key with a value in the current keychain. Both key and value will be prompted for, except when name is specified; then it will be used as the key's name.

    Character sequences can be used in values:

    "\n" - create a new line, and make the result a multi-line value.

    "\r", "\R" - these will be replaced with 2 and 4 (respectively) random printable characters.

    "\a", "\A" - these will be replaced with 2 and 4 (respectively) random alpha-numeric characters.

    Every character sequence can be used in values regardless of its order or count, and can be escaped using double backslashes (eg.: "\\a").

list [keychain]
    List the keys in the current keychain or if specified, in the keychain named keychain. Every key gets prefixed by its index number. keychain can be an index number or the keychain's name.

ls [keychain]
    Alias of list.

edit index
    Edit a key in the current keychain. index is the key's index number in the current keychain.

    Character sequence rules in values apply to this command also. See command new for more information about this.

search string
    Search for string in key names in the current keychain. If the search command is prefixed by a '*' (eg.: *search) then search in every keychain in the current database.

s string
    Alias of search.

*search string
    Search for string in key names in every keychain.

*s string
    Alias of *search.

/ pattern
    Search for pattern regular expression in key names in the current keychain. If the / command is prefixed by a '*' (eg.: */) then search in every keychain in the current database.

*/ pattern
    Search for pattern regular expression in key names in every keychain.

csearch string
    Search for string in keychain names in the current database.

c/ pattern
    Search for pattern regular expression in keychain names in the current database.

c keychain
    Change the current keychain. keychain can be an index number or the keychain's name.

cdel keychain
    Delete a keychain. keychain can be an index number or the keychain's name.

clear [count]
    Emulate a screen clearing. Scrolls 50 lines by default, which can be multiplied by count times if specified.

clist
    List keychains in the current database. Every keychain gets prefixed by its index number.

cls Alias of clist.

cnew [name]
    Create a new keychain. If name is not given then prompt for one. Empty string cancels the addition.

copy index keychain
    Copy a key in the current keychain to another keychain. index is the key's index to copy and keychain is the destination keychain's index number or name.

cp index keychain
    Alias of copy.

move index keychain
    Move a key in the current keychain to another keychain. index is the key's index to move and keychain is the destination keychain's index number or name.

mv index keychain
    Alias of move.

cren keychain
    Rename a keychain. keychain can be an index number or the keychain's name.

del index
    Delete a key from the current keychain. index is the key's index number in the current keychain.

rm index
    Alias of del.

passwd
    Change the current database's password. All changes will be written immediately.

help [command]
    Print application help or describe a command.

xport filename
    Export the current database as an XML file named filename. (see command import) NOTE: the created XML file will be plain text, and any existing files named filename will be overwritten.

import filename
    Import a database from the XML file named filename. It must be a properly formatted kc XML database. (see command xport) NOTE: The current database will be overwritten if saved.

quit
    Quit the program. If the database has been modified, then ask if it should be saved.

exit
    Alias of quit.

random [length]
    Print a random string with length length. The default length is 8.

version
    Display the program version.

write
    Save the current database.

save
    Alias of write.

  CIPHERS
All ciphers use 128 bit keys, generated with a KDF (key-derivation function) from the supplied password, an IV (initialization vector) and a salt. Both the IV and the salt are 128 bits long and read from the host's specific random device ( /dev/urandom on Linux and /dev/random on everything else ).

EXAMPLES

pwsafe_convert.pl:

        # Export the pwsafe database to a cleartext file:
        $ pwsafe --exportdb > pwsafe_export
        Enter passphrase for .pwsafe.dat:
        # Convert the cleartext pwsafe database to a kc XML database file:
        $ pwsafe_convert.pl pwsafe_export kc_db.xml
        opening pwsafe_export for reading.
        opening kc_db.xml for writing.
        Converting...
        Done.

    After the above commands, you should end up with a kc compatible XML database. You can import it to kc using the import command.

Adding new entries:

        Simple:
        default% > new testuser
        default% NEW value> testpass
        Prompt for both key and value:
        default% > new
        default% NEW key> testuser2
        default% NEW value> test_\r_pass_with_random_characters:\A
        Using the 'key' only as an indication:
        default% > new www.mysecuresite.com
        default% NEW value> user_name\npass-word
        Using the random and newline character sequences:
        default% > new testuser3
        default% NEW value> \r\R\n\a\A\nthis is a multiline value!
        Creating new keychains:
        default% > cnew email_accounts
        default% > cnew
        default% NEW keychain> WebSite Accounts
        Results:
        Listing the current keychain:
        default% > list
        0. testuser
        1. testuser2
        2. www.mysecuresite.com
        3. testuser3
        Listing any keychain:
        default% > list email_accounts
        empty keychain.
        default% > list 2    (<-- this is the "WebSite Accounts" keychain)
        empty keychain.
        Displaying values in the current keychain:
        default% > 0
        [testuser] testpass
        default% > 1
        [testuser2] test_,x_pass_with_random_characters:6nzm
        default% > 2
        [www.mysecuresite.com] [1/2] user_name
        [www.mysecuresite.com] [2/2] pass-word
        default% > 3
        [testuser3] [1/3] v#)z!9
        [testuser3] [2/3] HwRz7i
        [testuser3] [3/3] this is a multiline value!
        Listing keychains:
        default% > clist
        0. default
        1. email_accounts
        2. WebSite Accounts
        Switching to other keychains:
        default% > c email_accounts
        email_accounts% > c 2
        WebSite Accounts% >

Editing existing entries:

        default% > list
        0. testuser
        1. testuser2
        2. www.mysecuresite.com
        3. testuser3
        Edit an entry in the current keychain:
        default% > edit 1
        default% EDIT key> testuser2
        default% EDIT value> test_pass_with_random_characters:6nzm
        default% > 1
        [testuser2] test_pass_with_random_characters:6nzm
        Rename a keychain:
        default% > cren default
        default% RENAME keychain> my_own keychain
        my_own keychain% >

CAVEATS
If you use 'cfb128' or 'ofb' for cipher, there is no specific sign if you enter a wrong password during the opening of a database; in this case the database would seem to be corrupt after decrypting, and kc will not be able to open it.

There is no character conversion taking place for the input fields.

AUTHOR
kc was written by Daniel LEVAI <leva@ecentrum.hu>

Source, information, bugs: http://keychain.googlecode.com