Addec multiple channel private key support to Irssi SILC client.
[silc.git] / lib / silcclient / silcclient.h
index 2dcb7a58a8aaf9bf9c05b1d984a5f303d1afe741..1e069138a4b53a51c70a7eed51f7c75c4af4082d 100644 (file)
@@ -68,7 +68,6 @@ typedef struct SilcClientCommandStruct *SilcClientCommand;
 typedef struct SilcClientCommandContextStruct *SilcClientCommandContext;
 typedef struct SilcClientCommandReplyContextStruct 
                                            *SilcClientCommandReplyContext;
-typedef struct SilcChannelPrivateKeyStruct *SilcChannelPrivateKey;
 typedef struct SilcChannelUserStruct *SilcChannelUser;
 
 /* General definitions */
@@ -150,6 +149,27 @@ typedef struct {
 } *SilcPrivateMessageKeys;
 /***/
 
+/****s* silcclient/SilcClientAPI/SilcChannelPrivateKey
+ *
+ * NAME
+ *
+ *    typedef struct { ... } SilcChannelPrivateKey;
+ *
+ * DESCRIPTION
+ *
+ *    Structure to hold one channel private key. The array of this structure
+ *    is returned by silc_client_list_channel_private_keys function.
+ *
+ * SOURCE
+ */
+typedef struct SilcChannelPrivateKeyStruct {
+  char *name;                        /* Application given name */
+  SilcCipher cipher;                 /* The cipher and key */
+  SilcHmac hmac;                     /* The HMAC and hmac key */
+  unsigned char *key;                /* The key data */
+  SilcUInt32 key_len;                /* The key length */
+} *SilcChannelPrivateKey;
+/***/
 
 /****f* silcclient/SilcClientAPI/SilcAskPassphrase
  *
@@ -1471,6 +1491,7 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
  *    int silc_client_add_channel_private_key(SilcClient client,
  *                                            SilcClientConnection conn,
  *                                            SilcChannelEntry channel,
+ *                                            const char *name,
  *                                            char *cipher,
  *                                            char *hmac,
  *                                            unsigned char *key,
@@ -1485,6 +1506,7 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
  *    key in order to decrypt the messages. However, it is possible to have
  *    several private keys per one channel. In this case only some of the
  *    clients on the channel may know the one key and only some the other key.
+ *    The `name' can be application given name for the key.
  *
  *    The private key for channel is optional. If it is not set then the
  *    channel messages are encrypted using the channel key generated by the
@@ -1510,6 +1532,7 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
 int silc_client_add_channel_private_key(SilcClient client,
                                        SilcClientConnection conn,
                                        SilcChannelEntry channel,
+                                       const char *name,
                                        char *cipher,
                                        char *hmac,
                                        unsigned char *key,
@@ -1598,6 +1621,27 @@ silc_client_list_channel_private_keys(SilcClient client,
 void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
                                           SilcUInt32 key_count);
 
+/****f* silcclient/SilcClientAPI/silc_client_current_channel_private_key
+ *
+ * SYNOPSIS
+ *
+ *    void silc_client_current_channel_private_key(SilcClient client,
+ *                                                 SilcClientConnection conn,
+ *                                                 SilcChannelEntry channel,
+ *                                                 SilcChannelPrivateKey key);
+ *
+ * DESCRIPTION
+ *
+ *    Sets the `key' to be used as current channel private key on the
+ *    `channel'.  Packet sent after calling this function will be secured
+ *    with `key'.
+ *
+ ***/
+void silc_client_current_channel_private_key(SilcClient client,
+                                            SilcClientConnection conn,
+                                            SilcChannelEntry channel,
+                                            SilcChannelPrivateKey key);
+
 
 /* Key Agreement routines (client_keyagr.c) */