trash hexdump removed.
[silc.git] / lib / silcutil / silcapputil.h
index f054fa4d2b90be617d44a78be7c32186b3090eec..fd1717359cc39201478183331c8d5d011fbead9c 100644 (file)
@@ -1,10 +1,10 @@
 /*
 
-  silcapputil.h 
+  silcapputil.h
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2002 Pekka Riikonen
+  Copyright (C) 2002 - 2005 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
  *
  * SYNOPSIS
  *
- *    bool silc_create_key_pair(const char *pkcs_name,
- *                              SilcUInt32 key_len_bits,
- *                              const char *pub_filename,
- *                              const char *prv_filename,
- *                              const char *pub_identifier,
- *                              SilcPKCS *return_pkcs,
- *                              SilcPublicKey *return_public_key,
- *                              SilcPrivateKey *return_private_key,
- *                              bool interactive);
+ *    SilcBool silc_create_key_pair(const char *pkcs_name,
+ *                                  SilcUInt32 key_len_bits,
+ *                                  const char *pub_filename,
+ *                                  const char *prv_filename,
+ *                                  const char *pub_identifier,
+ *                                  const char *passphrase,
+ *                                  SilcPublicKey *return_public_key,
+ *                                  SilcPrivateKey *return_private_key,
+ *                                  SilcBool interactive);
  *
  * DESCRIPTION
  *
  *    "UN=foobar, HN=hostname"), or if NULL the routine generates it
  *    automatically.
  *
- *    The routine returns FALSE if error occurs during key generation.
- *    Function returns TRUE when success and returns the created SilcPKCS
- *    object, which can be used to perform public key cryptography into
- *    `return_pkcs' pointer, created public key into `return_public_key',
- *    and created private key into `return_private_key' pointer.
+ *    The `passphrase' is the passphrase that is used to encrypt the
+ *    private key file.  It is recommended that you would protect your
+ *    private key file with a passphrase.
  *
  *    If the `interactive' is TRUE then this asks the user (by blocking
  *    the process for input) some questions about key generation (like
  *    silc_pkcs_register_default function.
  *
  ***/
-bool silc_create_key_pair(const char *pkcs_name,
-                         SilcUInt32 key_len_bits,
-                         const char *pub_filename,
-                         const char *prv_filename,
-                         const char *pub_identifier,
-                         SilcPKCS *return_pkcs,
-                         SilcPublicKey *return_public_key,
-                         SilcPrivateKey *return_private_key,
-                         bool interactive);
+SilcBool silc_create_key_pair(const char *pkcs_name,
+                             SilcUInt32 key_len_bits,
+                             const char *pub_filename,
+                             const char *prv_filename,
+                             const char *pub_identifier,
+                             const char *passphrase,
+                             SilcPublicKey *return_public_key,
+                             SilcPrivateKey *return_private_key,
+                             SilcBool interactive);
 
 /****f* silcutil/SilcAppUtil/silc_load_key_pair
  *
  * SYNOPSIS
  *
- *    bool silc_load_key_pair(const char *pub_filename,
- *                            const char *prv_filename,
- *                            SilcPKCS *return_pkcs,
- *                            SilcPublicKey *return_public_key,
- *                            SilcPrivateKey *return_private_key);
+ *    SilcBool silc_load_key_pair(const char *pub_filename,
+ *                                const char *prv_filename,
+ *                                const char *passphrase,
+ *                                SilcPublicKey *return_public_key,
+ *                                SilcPrivateKey *return_private_key);
  *
  * DESCRIPTION
  *
  *    This routine can be used to load the public key and private key
  *    from files.  This retuns FALSE it either of the key could not be
  *    loaded.  This function returns TRUE on success and returns the
- *    public key into `return_public_key' pointer, private key into
- *    `return_private_key' pointer and the SilcPKCS object to the
- *    `return_pkcs'.  The SilcPKCS can be used to perform public key
- *    cryptographic operations.
+ *    public key into `return_public_key' pointer and private key into
+ *    `return_private_key'.  The `passphrase' is the passphrase which
+ *    will be used to decrypt the private key file.
  *
  ***/
-bool silc_load_key_pair(const char *pub_filename,
-                       const char *prv_filename,
-                       SilcPKCS *return_pkcs,
-                       SilcPublicKey *return_public_key,
-                       SilcPrivateKey *return_private_key);
+SilcBool silc_load_key_pair(const char *pub_filename,
+                           const char *prv_filename,
+                           const char *passphrase,
+                           SilcPublicKey *return_public_key,
+                           SilcPrivateKey *return_private_key);
 
 /****f* silcutil/SilcAppUtil/silc_show_public_key
  *
  * SYNOPSIS
  *
- *    bool silc_show_public_key(const char *pub_filename);
+ *    SilcBool silc_show_public_key(const char *pub_filename);
  *
  * DESCRIPTION
  *
@@ -129,6 +126,26 @@ bool silc_load_key_pair(const char *pub_filename,
  *    into human readable form into stdout.  Returns FALSE on error.
  *
  ***/
-bool silc_show_public_key(const char *pub_filename);
+SilcBool silc_show_public_key(const char *pub_filename);
+
+/****f* silcutil/SilcAppUtil/silc_change_private_key_passphrase
+ *
+ * SYNOPSIS
+ *
+ *    SilcBool silc_change_private_key_passphrase(const char *prv_filename,
+ *                                                const char *old_passphrase,
+ *                                                const char *new_passphrase);
+ *
+ * DESCRIPTION
+ *
+ *    This routine can be used to change the passphrase of the private
+ *    key file, which is used to encrypt the private key.  If the old
+ *    and new passphrase is not provided for this function this will
+ *    prompt for them.
+ *
+ ***/
+SilcBool silc_change_private_key_passphrase(const char *prv_filename,
+                                           const char *old_passphrase,
+                                           const char *new_passphrase);
 
 #endif /* SILCAPPUTIL_H */