gstmikey

gstmikey — Helper methods for dealing with MIKEY messages

Synopsis

#include <gst/sdp/gstmikey.h>

#define             GST_MIKEY_VERSION
enum                GstMIKEYType;
struct              GstMIKEYMessage;
GstMIKEYMessage *   gst_mikey_message_new               (void);
GstMIKEYMessage *   gst_mikey_message_new_from_bytes    (GBytes *bytes,
                                                         GstMIKEYDecryptInfo *info,
                                                         GError **error);
GstMIKEYMessage *   gst_mikey_message_new_from_data     (gconstpointer data,
                                                         gsize size,
                                                         GstMIKEYDecryptInfo *info,
                                                         GError **error);
GBytes *            gst_mikey_message_to_bytes          (GstMIKEYMessage *msg,
                                                         GstMIKEYEncryptInfo *info,
                                                         GError **error);

enum                GstMIKEYPRFFunc;
enum                GstMIKEYMapType;
gboolean            gst_mikey_message_set_info          (GstMIKEYMessage *msg,
                                                         guint8 version,
                                                         GstMIKEYType type,
                                                         gboolean V,
                                                         GstMIKEYPRFFunc prf_func,
                                                         guint32 CSB_id,
                                                         GstMIKEYMapType map_type);
guint               gst_mikey_message_get_n_cs          (const GstMIKEYMessage *msg);

                    GstMIKEYMapSRTP;
const GstMIKEYMapSRTP * gst_mikey_message_get_cs_srtp   (const GstMIKEYMessage *msg,
                                                         guint idx);
gboolean            gst_mikey_message_insert_cs_srtp    (GstMIKEYMessage *msg,
                                                         gint idx,
                                                         const GstMIKEYMapSRTP *map);
gboolean            gst_mikey_message_remove_cs_srtp    (GstMIKEYMessage *msg,
                                                         gint idx);
gboolean            gst_mikey_message_replace_cs_srtp   (GstMIKEYMessage *msg,
                                                         gint idx,
                                                         const GstMIKEYMapSRTP *map);
gboolean            gst_mikey_message_add_cs_srtp       (GstMIKEYMessage *msg,
                                                         guint8 policy,
                                                         guint32 ssrc,
                                                         guint32 roc);

guint               gst_mikey_message_get_n_payloads    (const GstMIKEYMessage *msg);
const GstMIKEYPayload * gst_mikey_message_get_payload   (const GstMIKEYMessage *msg,
                                                         guint idx);
const GstMIKEYPayload * gst_mikey_message_find_payload  (const GstMIKEYMessage *msg,
                                                         GstMIKEYPayloadType type,
                                                         guint nth);
gboolean            gst_mikey_message_insert_payload    (GstMIKEYMessage *msg,
                                                         guint idx,
                                                         GstMIKEYPayload *payload);
gboolean            gst_mikey_message_remove_payload    (GstMIKEYMessage *msg,
                                                         guint idx);
gboolean            gst_mikey_message_replace_payload   (GstMIKEYMessage *msg,
                                                         guint idx,
                                                         GstMIKEYPayload *payload);
gboolean            gst_mikey_message_add_payload       (GstMIKEYMessage *msg,
                                                         GstMIKEYPayload *payload);
enum                GstMIKEYPayloadType;
struct              GstMIKEYPayload;
GstMIKEYPayload *   gst_mikey_payload_new               (GstMIKEYPayloadType type);
GstMIKEYPayload *   gst_mikey_payload_copy              (const GstMIKEYPayload *buf);

enum                GstMIKEYEncAlg;
enum                GstMIKEYMacAlg;
                    GstMIKEYPayloadKEMAC;
gboolean            gst_mikey_payload_kemac_set         (GstMIKEYPayload *payload,
                                                         GstMIKEYEncAlg enc_alg,
                                                         GstMIKEYMacAlg mac_alg);

enum                GstMIKEYCacheType;
                    GstMIKEYPayloadPKE;
gboolean            gst_mikey_payload_pke_set           (GstMIKEYPayload *payload,
                                                         GstMIKEYCacheType C,
                                                         guint16 data_len,
                                                         const guint8 *data);
gboolean            gst_mikey_message_add_pke           (GstMIKEYMessage *msg,
                                                         GstMIKEYCacheType C,
                                                         guint16 data_len,
                                                         const guint8 *data);

enum                GstMIKEYTSType;
                    GstMIKEYPayloadT;
gboolean            gst_mikey_payload_t_set             (GstMIKEYPayload *payload,
                                                         GstMIKEYTSType type,
                                                         const guint8 *ts_value);
gboolean            gst_mikey_message_add_t             (GstMIKEYMessage *msg,
                                                         GstMIKEYTSType type,
                                                         const guint8 *ts_value);
gboolean            gst_mikey_message_add_t_now_ntp_utc (GstMIKEYMessage *msg);

                    GstMIKEYPayloadRAND;
gboolean            gst_mikey_payload_rand_set          (GstMIKEYPayload *payload,
                                                         guint8 len,
                                                         const guint8 *rand);
gboolean            gst_mikey_message_add_rand          (GstMIKEYMessage *msg,
                                                         guint8 len,
                                                         const guint8 *rand);
gboolean            gst_mikey_message_add_rand_len      (GstMIKEYMessage *msg,
                                                         guint8 len);

enum                GstMIKEYSecProto;
enum                GstMIKEYSecSRTP;
                    GstMIKEYPayloadSP;
                    GstMIKEYPayloadSPParam;
gboolean            gst_mikey_payload_sp_set            (GstMIKEYPayload *payload,
                                                         guint policy,
                                                         GstMIKEYSecProto proto);
guint               gst_mikey_payload_sp_get_n_params   (const GstMIKEYPayload *payload);
const GstMIKEYPayloadSPParam * gst_mikey_payload_sp_get_param
                                                        (const GstMIKEYPayload *payload,
                                                         guint idx);
gboolean            gst_mikey_payload_sp_add_param      (GstMIKEYPayload *payload,
                                                         guint8 type,
                                                         guint8 len,
                                                         const guint8 *val);
gboolean            gst_mikey_payload_sp_remove_param   (GstMIKEYPayload *payload,
                                                         guint idx);

Description

The GstMIKEY helper functions makes it easy to parse and create MIKEY messages.

Details

GST_MIKEY_VERSION

#define GST_MIKEY_VERSION 1

The supported MIKEY version 1.


enum GstMIKEYType

typedef enum {
  GST_MIKEY_TYPE_INVALID    = -1,
  GST_MIKEY_TYPE_PSK_INIT   = 0,
  GST_MIKEY_TYPE_PSK_VERIFY = 1,
  GST_MIKEY_TYPE_PK_INIT    = 2,
  GST_MIKEY_TYPE_PK_VERIFY  = 3,
  GST_MIKEY_TYPE_DH_INIT    = 4,
  GST_MIKEY_TYPE_DH_RESP    = 5,
  GST_MIKEY_TYPE_ERROR      = 6
} GstMIKEYType;

Different MIKEY data types.

GST_MIKEY_TYPE_INVALID

Invalid type

GST_MIKEY_TYPE_PSK_INIT

Initiator's pre-shared key message

GST_MIKEY_TYPE_PSK_VERIFY

Verification message of a Pre-shared key message

GST_MIKEY_TYPE_PK_INIT

Initiator's public-key transport message

GST_MIKEY_TYPE_PK_VERIFY

Verification message of a public-key message

GST_MIKEY_TYPE_DH_INIT

Initiator's DH exchange message

GST_MIKEY_TYPE_DH_RESP

Responder's DH exchange message

GST_MIKEY_TYPE_ERROR

Error message

struct GstMIKEYMessage

struct GstMIKEYMessage {
  GstMiniObject mini_object;

  guint8 version;
  GstMIKEYType type;
  gboolean V;
  GstMIKEYPRFFunc prf_func;
  guint32 CSB_id;
  GstMIKEYMapType map_type;
  GArray *map_info;
  GArray *payloads;
};

Structure holding the information of the MIKEY message

GstMiniObject mini_object;

guint8 version;

the version

GstMIKEYType type;

the GstMIKEYType message type

gboolean V;

verify flag

GstMIKEYPRFFunc prf_func;

a GstMIKEYPRFFunc

guint32 CSB_id;

Identifies the Crypto Session Bundle

GstMIKEYMapType map_type;

a GstMIKEYMapType

GArray *map_info;

map info array of type depending on map_type

GArray *payloads;

the payload array of GstMIKEYPayload

gst_mikey_message_new ()

GstMIKEYMessage *   gst_mikey_message_new               (void);

Make a new MIKEY message.

Returns :

a new GstMIKEYMessage on success

Since 1.4


gst_mikey_message_new_from_bytes ()

GstMIKEYMessage *   gst_mikey_message_new_from_bytes    (GBytes *bytes,
                                                         GstMIKEYDecryptInfo *info,
                                                         GError **error);

Make a new GstMIKEYMessage from bytes.

bytes :

a GBytes

info :

a GstMIKEYDecryptInfo

error :

a GError

Returns :

a new GstMIKEYMessage

Since 1.4


gst_mikey_message_new_from_data ()

GstMIKEYMessage *   gst_mikey_message_new_from_data     (gconstpointer data,
                                                         gsize size,
                                                         GstMIKEYDecryptInfo *info,
                                                         GError **error);

Parse size bytes from data into a GstMIKEYMessage. info contains the parameters to decrypt and verify the data.

data :

bytes to read. [array length=size][element-type guint8]

size :

length of data

info :

GstMIKEYDecryptInfo

error :

a GError

Returns :

a GstMIKEYMessage on success or NULL when parsing failed and error will be set.

Since 1.4


gst_mikey_message_to_bytes ()

GBytes *            gst_mikey_message_to_bytes          (GstMIKEYMessage *msg,
                                                         GstMIKEYEncryptInfo *info,
                                                         GError **error);

Convert msg to a GBytes.

msg :

a GstMIKEYMessage

info :

a GstMIKEYEncryptInfo

error :

a GError

Returns :

a new GBytes for msg.

Since 1.4


enum GstMIKEYPRFFunc

typedef enum {
  GST_MIKEY_PRF_MIKEY_1  = 0
} GstMIKEYPRFFunc;

The PRF function that has been/will be used for key derivation

GST_MIKEY_PRF_MIKEY_1

MIKEY-1 PRF function

enum GstMIKEYMapType

typedef enum {
  GST_MIKEY_MAP_TYPE_SRTP  = 0
} GstMIKEYMapType;

Specifies the method of uniquely mapping Crypto Sessions to the security protocol sessions.


gst_mikey_message_set_info ()

gboolean            gst_mikey_message_set_info          (GstMIKEYMessage *msg,
                                                         guint8 version,
                                                         GstMIKEYType type,
                                                         gboolean V,
                                                         GstMIKEYPRFFunc prf_func,
                                                         guint32 CSB_id,
                                                         GstMIKEYMapType map_type);

Set the information in msg.

msg :

a GstMIKEYMessage

version :

a version

type :

a GstMIKEYType

V :

verify flag

prf_func :

the GstMIKEYPRFFunc function to use

CSB_id :

the Crypto Session Bundle id

map_type :

the GstMIKEYCSIDMapType

Returns :

TRUE on success

Since 1.4


gst_mikey_message_get_n_cs ()

guint               gst_mikey_message_get_n_cs          (const GstMIKEYMessage *msg);

Get the number of crypto sessions in msg.

msg :

a GstMIKEYMessage

Returns :

the number of crypto sessions

Since 1.4


GstMIKEYMapSRTP

typedef struct {
  guint8  policy;
  guint32 ssrc;
  guint32 roc;
} GstMIKEYMapSRTP;

The Security policy Map item for SRTP

guint8 policy;

The security policy applied for the stream with ssrc

guint32 ssrc;

the SSRC that must be used for the stream

guint32 roc;

current rollover counter

gst_mikey_message_get_cs_srtp ()

const GstMIKEYMapSRTP * gst_mikey_message_get_cs_srtp   (const GstMIKEYMessage *msg,
                                                         guint idx);

Get the policy information of msg at idx.

msg :

a GstMIKEYMessage

idx :

an index

Returns :

a GstMIKEYMapSRTP

Since 1.4


gst_mikey_message_insert_cs_srtp ()

gboolean            gst_mikey_message_insert_cs_srtp    (GstMIKEYMessage *msg,
                                                         gint idx,
                                                         const GstMIKEYMapSRTP *map);

Insert a Crypto Session map for SRTP in msg at idx

When idx is -1, the policy will be appended.

msg :

a GstMIKEYMessage

idx :

the index to insert at

map :

the map info

Returns :

TRUE on success

Since 1.4


gst_mikey_message_remove_cs_srtp ()

gboolean            gst_mikey_message_remove_cs_srtp    (GstMIKEYMessage *msg,
                                                         gint idx);

Remove the SRTP policy at idx.

msg :

a GstMIKEYMessage

idx :

the index to remove

Returns :

TRUE on success

Since 1.4


gst_mikey_message_replace_cs_srtp ()

gboolean            gst_mikey_message_replace_cs_srtp   (GstMIKEYMessage *msg,
                                                         gint idx,
                                                         const GstMIKEYMapSRTP *map);

Replace a Crypto Session map for SRTP in msg at idx with map.

msg :

a GstMIKEYMessage

idx :

the index to insert at

map :

the map info

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_cs_srtp ()

gboolean            gst_mikey_message_add_cs_srtp       (GstMIKEYMessage *msg,
                                                         guint8 policy,
                                                         guint32 ssrc,
                                                         guint32 roc);

Add a Crypto policy for SRTP to msg.

msg :

a GstMIKEYMessage

policy :

The security policy applied for the stream with ssrc

ssrc :

the SSRC that must be used for the stream

roc :

current rollover counter

Returns :

TRUE on success

Since 1.4


gst_mikey_message_get_n_payloads ()

guint               gst_mikey_message_get_n_payloads    (const GstMIKEYMessage *msg);

Get the number of payloads in msg.

msg :

a GstMIKEYMessage

Returns :

the number of payloads in msg

Since 1.4


gst_mikey_message_get_payload ()

const GstMIKEYPayload * gst_mikey_message_get_payload   (const GstMIKEYMessage *msg,
                                                         guint idx);

Get the GstMIKEYPayload at idx in msg

msg :

a GstMIKEYMessage

idx :

an index

Returns :

the GstMIKEYPayload at idx. The payload remains valid for as long as it is part of msg. [transfer none]

Since 1.4


gst_mikey_message_find_payload ()

const GstMIKEYPayload * gst_mikey_message_find_payload  (const GstMIKEYMessage *msg,
                                                         GstMIKEYPayloadType type,
                                                         guint nth);

Find the nth occurence of the payload with type in msg.

msg :

a GstMIKEYMessage

type :

a GstMIKEYPayloadType

nth :

payload to find

Returns :

the nth GstMIKEYPayload of type.

Since 1.4


gst_mikey_message_insert_payload ()

gboolean            gst_mikey_message_insert_payload    (GstMIKEYMessage *msg,
                                                         guint idx,
                                                         GstMIKEYPayload *payload);

Insert the payload at index idx in msg. If idx is -1, the payload will be appended to msg.

msg :

a GstMIKEYMessage

idx :

an index

payload :

a GstMIKEYPayload. [transfer full]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_remove_payload ()

gboolean            gst_mikey_message_remove_payload    (GstMIKEYMessage *msg,
                                                         guint idx);

Remove the payload in msg at idx

msg :

a GstMIKEYMessage

idx :

an index

Returns :

TRUE on success

Since 1.4


gst_mikey_message_replace_payload ()

gboolean            gst_mikey_message_replace_payload   (GstMIKEYMessage *msg,
                                                         guint idx,
                                                         GstMIKEYPayload *payload);

Replace the payload at idx in msg with payload.

msg :

a GstMIKEYMessage

idx :

an index

payload :

a GstMIKEYPayload. [transfer full]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_payload ()

gboolean            gst_mikey_message_add_payload       (GstMIKEYMessage *msg,
                                                         GstMIKEYPayload *payload);

Add a new payload to msg.

msg :

a GstMIKEYMessage

payload :

a GstMIKEYPayload. [transfer full]

Returns :

TRUE on success

Since 1.4


enum GstMIKEYPayloadType

typedef enum {
  GST_MIKEY_PT_LAST      = 0,
  GST_MIKEY_PT_KEMAC     = 1,
  GST_MIKEY_PT_PKE       = 2,
  GST_MIKEY_PT_DH        = 3,
  GST_MIKEY_PT_SIGN      = 4,
  GST_MIKEY_PT_T         = 5,
  GST_MIKEY_PT_ID        = 6,
  GST_MIKEY_PT_CERT      = 7,
  GST_MIKEY_PT_CHASH     = 8,
  GST_MIKEY_PT_V         = 9,
  GST_MIKEY_PT_SP        = 10,
  GST_MIKEY_PT_RAND      = 11,
  GST_MIKEY_PT_ERR       = 12,
  GST_MIKEY_PT_KEY_DATA  = 20,
  GST_MIKEY_PT_GEN_EXT   = 21
} GstMIKEYPayloadType;

Different MIKEY Payload types.

GST_MIKEY_PT_LAST

Last payload

GST_MIKEY_PT_KEMAC

Key data transport payload

GST_MIKEY_PT_PKE

Envelope data payload

GST_MIKEY_PT_DH

DH data payload

GST_MIKEY_PT_SIGN

Signature payload

GST_MIKEY_PT_T

Timestamp payload

GST_MIKEY_PT_ID

ID payload

GST_MIKEY_PT_CERT

Certificate Payload

GST_MIKEY_PT_CHASH

Cert hash payload

GST_MIKEY_PT_V

Verfication message payload

GST_MIKEY_PT_SP

Security Policy payload

GST_MIKEY_PT_RAND

RAND payload

GST_MIKEY_PT_ERR

Error payload

GST_MIKEY_PT_KEY_DATA

Key data sub-payload

GST_MIKEY_PT_GEN_EXT

General Extension Payload

struct GstMIKEYPayload

struct GstMIKEYPayload {
  GstMiniObject mini_object;

  GstMIKEYPayloadType type;
  guint len;
};

Hold the common fields for all payloads

GstMiniObject mini_object;

GstMIKEYPayloadType type;

the payload type

guint len;

length of the payload

gst_mikey_payload_new ()

GstMIKEYPayload *   gst_mikey_payload_new               (GstMIKEYPayloadType type);

Make a new GstMIKEYPayload with type.

type :

a GstMIKEYPayloadType

Returns :

a new GstMIKEYPayload or NULL on failure. [nullable]

Since 1.4


gst_mikey_payload_copy ()

GstMIKEYPayload *   gst_mikey_payload_copy              (const GstMIKEYPayload *buf);

Create a copy of the given payload.

payload :

a GstMIKEYPayload.

Returns :

a new copy of payload. [transfer full]

Since 1.4


enum GstMIKEYEncAlg

typedef enum {
  GST_MIKEY_ENC_NULL        = 0,
  GST_MIKEY_ENC_AES_CM_128  = 1,
  GST_MIKEY_ENC_AES_KW_128  = 2
} GstMIKEYEncAlg;

The encryption algorithm used to encrypt the Encr data field

GST_MIKEY_ENC_NULL

no encryption

GST_MIKEY_ENC_AES_CM_128

AES-CM using a 128-bit key

GST_MIKEY_ENC_AES_KW_128

AES Key Wrap using a 128-bit key

enum GstMIKEYMacAlg

typedef enum {
  GST_MIKEY_MAC_NULL            = 0,
  GST_MIKEY_MAC_HMAC_SHA_1_160  = 1
} GstMIKEYMacAlg;

Specifies the authentication algorithm used

GST_MIKEY_MAC_NULL

no authentication

GST_MIKEY_MAC_HMAC_SHA_1_160

HMAC-SHA-1-160

GstMIKEYPayloadKEMAC

typedef struct {
  GstMIKEYPayload pt;

  GstMIKEYEncAlg  enc_alg;
  GstMIKEYMacAlg  mac_alg;
  GArray *subpayloads;
} GstMIKEYPayloadKEMAC;

A structure holding the KEMAC payload

GstMIKEYPayload pt;

the common GstMIKEYPayload

GstMIKEYEncAlg enc_alg;

the GstMIKEYEncAlg

GstMIKEYMacAlg mac_alg;

the GstMIKEYMacAlg

GArray *subpayloads;


gst_mikey_payload_kemac_set ()

gboolean            gst_mikey_payload_kemac_set         (GstMIKEYPayload *payload,
                                                         GstMIKEYEncAlg enc_alg,
                                                         GstMIKEYMacAlg mac_alg);

Set the KEMAC parameters. payload should point to a GST_MIKEY_PT_KEMAC payload.

payload :

a GstMIKEYPayload

enc_alg :

the GstMIKEYEncAlg

mac_alg :

a GstMIKEYMacAlg

Returns :

TRUE on success

Since 1.4


enum GstMIKEYCacheType

typedef enum {
  GST_MIKEY_CACHE_NONE       = 0,
  GST_MIKEY_CACHE_ALWAYS     = 1,
  GST_MIKEY_CACHE_FOR_CSB    = 2
} GstMIKEYCacheType;

The different cache types

GST_MIKEY_CACHE_NONE

The envelope key MUST NOT be cached

GST_MIKEY_CACHE_ALWAYS

The envelope key MUST be cached

GST_MIKEY_CACHE_FOR_CSB

The envelope key MUST be cached, but only to be used for the specific CSB.

GstMIKEYPayloadPKE

typedef struct {
  GstMIKEYPayload pt;

  GstMIKEYCacheType C;
  guint16           data_len;
  guint8           *data;
} GstMIKEYPayloadPKE;

The Envelope data payload contains the encrypted envelope key that is used in the public-key transport to protect the data in the Key data transport payload. The encryption algorithm used is implicit from the certificate/public key used.

GstMIKEYPayload pt;

the common GstMIKEYPayload

GstMIKEYCacheType C;

envelope key cache indicator

guint16 data_len;

length of data

guint8 *data;

the encrypted envelope key

gst_mikey_payload_pke_set ()

gboolean            gst_mikey_payload_pke_set           (GstMIKEYPayload *payload,
                                                         GstMIKEYCacheType C,
                                                         guint16 data_len,
                                                         const guint8 *data);

Set the PKE values in payload. payload must be of type GST_MIKEY_PT_PKE.

payload :

a GstMIKEYPayload

C :

envelope key cache indicator

data_len :

the length of data

data :

the encrypted envelope key. [array length=data_len]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_pke ()

gboolean            gst_mikey_message_add_pke           (GstMIKEYMessage *msg,
                                                         GstMIKEYCacheType C,
                                                         guint16 data_len,
                                                         const guint8 *data);

Add a new PKE payload to msg with the given parameters.

msg :

a GstMIKEYMessage

C :

envelope key cache indicator

data_len :

the length of data

data :

the encrypted envelope key. [array length=data_len]

Returns :

TRUE on success

Since 1.4


enum GstMIKEYTSType

typedef enum {
  GST_MIKEY_TS_TYPE_NTP_UTC  = 0,
  GST_MIKEY_TS_TYPE_NTP      = 1,
  GST_MIKEY_TS_TYPE_COUNTER  = 2
} GstMIKEYTSType;

Specifies the timestamp type.

GST_MIKEY_TS_TYPE_NTP_UTC

an NTP time in UTC timezone

GST_MIKEY_TS_TYPE_NTP

an NTP time

GST_MIKEY_TS_TYPE_COUNTER

a counter

GstMIKEYPayloadT

typedef struct {
  GstMIKEYPayload pt;

  GstMIKEYTSType  type;
  guint8         *ts_value;
} GstMIKEYPayloadT;

The timestamp payload carries the timestamp information

GstMIKEYPayload pt;

the payload header

GstMIKEYTSType type;

a GstMIKEYTSType

guint8 *ts_value;

the timestamp value

gst_mikey_payload_t_set ()

gboolean            gst_mikey_payload_t_set             (GstMIKEYPayload *payload,
                                                         GstMIKEYTSType type,
                                                         const guint8 *ts_value);

Set the timestamp in a GST_MIKEY_PT_T payload.

payload :

a GstMIKEYPayload

type :

the GstMIKEYTSType

ts_value :

the timestamp value. [array]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_t ()

gboolean            gst_mikey_message_add_t             (GstMIKEYMessage *msg,
                                                         GstMIKEYTSType type,
                                                         const guint8 *ts_value);

Add a new T payload to msg with the given parameters.

msg :

a GstMIKEYMessage

type :

specifies the timestamp type used

ts_value :

The timestamp value of the specified type. [array]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_t_now_ntp_utc ()

gboolean            gst_mikey_message_add_t_now_ntp_utc (GstMIKEYMessage *msg);

Add a new T payload to msg that contains the current time in NTP-UTC format.

msg :

a GstMIKEYMessage

Returns :

TRUE on success

Since 1.4


GstMIKEYPayloadRAND

typedef struct {
  GstMIKEYPayload pt;

  guint8  len;
  guint8 *rand;
} GstMIKEYPayloadRAND;

The RAND payload consists of a (pseudo-)random bit-string

GstMIKEYPayload pt;

the payload header

guint8 len;

the length of rand

guint8 *rand;

random values

gst_mikey_payload_rand_set ()

gboolean            gst_mikey_payload_rand_set          (GstMIKEYPayload *payload,
                                                         guint8 len,
                                                         const guint8 *rand);

Set the random values in a GST_MIKEY_PT_RAND payload.

payload :

a GstMIKEYPayload

len :

the length of rand

rand :

random values. [array length=len]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_rand ()

gboolean            gst_mikey_message_add_rand          (GstMIKEYMessage *msg,
                                                         guint8 len,
                                                         const guint8 *rand);

Add a new RAND payload to msg with the given parameters.

msg :

a GstMIKEYMessage

len :

the length of rand

rand :

random data. [array length=len]

Returns :

TRUE on success

Since 1.4


gst_mikey_message_add_rand_len ()

gboolean            gst_mikey_message_add_rand_len      (GstMIKEYMessage *msg,
                                                         guint8 len);

Add a new RAND payload to msg with len random bytes.

msg :

a GstMIKEYMessage

len :

length

Returns :

TRUE on success

Since 1.4


enum GstMIKEYSecProto

typedef enum {
  GST_MIKEY_SEC_PROTO_SRTP  = 0
} GstMIKEYSecProto;

Specifies the security protocol


enum GstMIKEYSecSRTP

typedef enum {
  GST_MIKEY_SP_SRTP_ENC_ALG         =    0,
  GST_MIKEY_SP_SRTP_ENC_KEY_LEN     =    1,
  GST_MIKEY_SP_SRTP_AUTH_ALG        =    2,
  GST_MIKEY_SP_SRTP_AUTH_KEY_LEN    =    3,
  GST_MIKEY_SP_SRTP_SALT_KEY_LEN    =    4,
  GST_MIKEY_SP_SRTP_PRF             =    5,
  GST_MIKEY_SP_SRTP_KEY_DERIV_RATE  =    6,
  GST_MIKEY_SP_SRTP_SRTP_ENC        =    7,
  GST_MIKEY_SP_SRTP_SRTCP_ENC       =    8,
  GST_MIKEY_SP_SRTP_FEC_ORDER       =    9,
  GST_MIKEY_SP_SRTP_SRTP_AUTH       =   10,
  GST_MIKEY_SP_SRTP_AUTH_TAG_LEN    =   11,
  GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN =   12
} GstMIKEYSecSRTP;

This policy specifies the parameters for SRTP and SRTCP

GST_MIKEY_SP_SRTP_ENC_ALG

Encryption algorithm

GST_MIKEY_SP_SRTP_ENC_KEY_LEN

Session Encr. key length

GST_MIKEY_SP_SRTP_AUTH_ALG

Authentication algorithm

GST_MIKEY_SP_SRTP_AUTH_KEY_LEN

Session Auth. key length

GST_MIKEY_SP_SRTP_SALT_KEY_LEN

Session Salt key length

GST_MIKEY_SP_SRTP_PRF

SRTP Pseudo Random Function

GST_MIKEY_SP_SRTP_KEY_DERIV_RATE

Key derivation rate

GST_MIKEY_SP_SRTP_SRTP_ENC

SRTP encryption off/on, 0 if off, 1 if on

GST_MIKEY_SP_SRTP_SRTCP_ENC

SRTCP encryption off/on, 0 if off, 1 if on

GST_MIKEY_SP_SRTP_FEC_ORDER

sender's FEC order

GST_MIKEY_SP_SRTP_SRTP_AUTH

SRTP authentication off/on, 0 if off, 1 if on

GST_MIKEY_SP_SRTP_AUTH_TAG_LEN

Authentication tag length

GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN

SRTP prefix length

GstMIKEYPayloadSP

typedef struct {
  GstMIKEYPayload pt;

  guint policy;
  GstMIKEYSecProto proto;
  GArray *params;
} GstMIKEYPayloadSP;

The Security Policy payload defines a set of policies that apply to a specific security protocol

GstMIKEYPayload pt;

the payload header

guint policy;

the policy number

GstMIKEYSecProto proto;

the security protocol

GArray *params;

array of GstMIKEYPayloadPSParam

GstMIKEYPayloadSPParam

typedef struct {
  guint8  type;
  guint8  len;
  guint8 *val;
} GstMIKEYPayloadSPParam;

A Type/Length/Value field for security paramaters

guint8 type;

specifies the type of the parameter

guint8 len;

specifies the length of val

guint8 *val;

specifies the value of the parameter

gst_mikey_payload_sp_set ()

gboolean            gst_mikey_payload_sp_set            (GstMIKEYPayload *payload,
                                                         guint policy,
                                                         GstMIKEYSecProto proto);

Set the Security Policy parameters for payload.

payload :

a GstMIKEYPayload

policy :

the policy number

proto :

a GstMIKEYSecProto

Returns :

TRUE on success

Since 1.4


gst_mikey_payload_sp_get_n_params ()

guint               gst_mikey_payload_sp_get_n_params   (const GstMIKEYPayload *payload);

Get the number of security policy parameters in a GST_MIKEY_PT_SP payload.

payload :

a GstMIKEYPayload

Returns :

the number of parameters in payload

Since 1.4


gst_mikey_payload_sp_get_param ()

const GstMIKEYPayloadSPParam * gst_mikey_payload_sp_get_param
                                                        (const GstMIKEYPayload *payload,
                                                         guint idx);

Get the Security Policy parameter in a GST_MIKEY_PT_SP payload at idx.

payload :

a GstMIKEYPayload

idx :

an index

Returns :

the GstMIKEYPayloadSPParam at idx in payload

Since 1.4


gst_mikey_payload_sp_add_param ()

gboolean            gst_mikey_payload_sp_add_param      (GstMIKEYPayload *payload,
                                                         guint8 type,
                                                         guint8 len,
                                                         const guint8 *val);

Add a new parameter to the GST_MIKEY_PT_SP payload with type, len and val.

payload :

a GstMIKEYPayload

type :

a type

len :

a length

val :

len bytes of data. [array length=len]

Returns :

TRUE on success

Since 1.4


gst_mikey_payload_sp_remove_param ()

gboolean            gst_mikey_payload_sp_remove_param   (GstMIKEYPayload *payload,
                                                         guint idx);

Remove the Security Policy parameters from a GST_MIKEY_PT_SP payload at idx.

payload :

a GstMIKEYPayload

idx :

an index

Returns :

TRUE on success

Since 1.4