*/
-/****h* silccore/SilcPrivateAPI
+/****h* silccore/SILC Private Message Interface
*
* DESCRIPTION
*
* SYNOPSIS
*
* SilcPrivateMessagePayload
- * silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher);
+ * silc_private_message_payload_parse(unsigned char *payload,
+ * SilcUInt32 payload_len,
+ * SilcCipher cipher,
+ * SilcHmac hmac);
*
* DESCRIPTION
*
* Parses private message payload returning new private mesage payload
* structure. This also decrypts the message if the `cipher' is provided.
+ * The data integrity is checked with `hmac'.
*
***/
SilcPrivateMessagePayload
-silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher);
+silc_private_message_payload_parse(unsigned char *payload,
+ SilcUInt32 payload_len,
+ SilcCipher cipher,
+ SilcHmac hmac);
/****f* silccore/SilcPrivateAPI/silc_private_message_payload_encode
*
* SYNOPSIS
*
- * SilcBuffer silc_private_message_payload_encode(uint16 flags,
- * uint16 data_len,
- * unsigned char *data,
- * SilcCipher cipher);
+ * SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
+ * SilcUInt16 data_len,
+ * const unsigned char *data,
+ * SilcCipher cipher,
+ * SilcHmac hmac,
+ * SilcRng rng);
*
* DESCRIPTION
*
* Encodes private message payload into a buffer and returns it. If
- * the cipher is provided the packet is also encrypted here. It is provided
- * if the private message private keys are used.
+ * the `cipher' is provided the packet is also encrypted here. It is
+ * provided if the private message private keys are used. If the `rng'
+ * is NULL then global RNG is used, if non-NULL then `rng' is used.
+ * The MAC for the message is computed with `hmac'.
*
***/
-SilcBuffer silc_private_message_payload_encode(uint16 flags,
- uint16 data_len,
- unsigned char *data,
- SilcCipher cipher);
+SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
+ SilcUInt16 data_len,
+ const unsigned char *data,
+ SilcCipher cipher,
+ SilcHmac hmac,
+ SilcRng rng);
/****f* silccore/SilcPrivateAPI/silc_private_message_payload_free
*
*
* SYNOPSIS
*
- * uint16
+ * SilcUInt16
* silc_private_message_get_flags(SilcPrivateMessagePayload payload);
*
* DESCRIPTION
* channel message flags.
*
***/
-uint16
+SilcUInt16
silc_private_message_get_flags(SilcPrivateMessagePayload payload);
/****f* silccore/SilcPrivateAPI/silc_private_message_get_message
* SYNOPSIS
*
* unsigned char *
- * silc_private_message_get_nickname(SilcPrivateMessagePayload payload,
- * uint32 *nickname_len);
+ * silc_private_message_get_message(SilcPrivateMessagePayload payload,
+ * SilcUInt32 *message_len);
*
* DESCRIPTION
*
***/
unsigned char *
silc_private_message_get_message(SilcPrivateMessagePayload payload,
- uint32 *message_len);
+ SilcUInt32 *message_len);
+
+/****f* silccore/SilcPrivateAPI/silc_private_message_get_mac
+ *
+ * SYNOPSIS
+ *
+ * unsigned char *
+ * silc_private_message_get_mac(SilcPrivateMessagePayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Returns the MAC from the payload. The caller knows its length.
+ * The caller must not free it.
+ *
+ ***/
+unsigned char *
+silc_private_message_get_mac(SilcPrivateMessagePayload payload);
#endif