![]() |
![]() |
![]() |
GStreamer Base Plugins 1.0 Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#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
);
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.
Invalid type | |
Initiator's pre-shared key message | |
Verification message of a Pre-shared key message | |
Initiator's public-key transport message | |
Verification message of a public-key message | |
Initiator's DH exchange message | |
Responder's DH exchange message | |
Error message |
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
guint8 |
the version |
GstMIKEYType |
the GstMIKEYType message type |
gboolean |
verify flag |
GstMIKEYPRFFunc |
a GstMIKEYPRFFunc |
guint32 |
Identifies the Crypto Session Bundle |
GstMIKEYMapType |
a GstMIKEYMapType |
GArray * |
map info array of type depending on map_type
|
GArray * |
the payload array of GstMIKEYPayload |
GstMIKEYMessage * gst_mikey_message_new (void
);
Make a new MIKEY message.
Returns : |
a new GstMIKEYMessage on success |
Since 1.4
GstMIKEYMessage * gst_mikey_message_new_from_bytes (GBytes *bytes
,GstMIKEYDecryptInfo *info
,GError **error
);
Make a new GstMIKEYMessage from bytes
.
|
a GBytes |
|
a GstMIKEYDecryptInfo |
|
a GError |
Returns : |
a new GstMIKEYMessage |
Since 1.4
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.
|
bytes to read. [array length=size][element-type guint8] |
|
length of data
|
|
GstMIKEYDecryptInfo |
|
a GError |
Returns : |
a GstMIKEYMessage on success or NULL when parsing failed and
error will be set. |
Since 1.4
GBytes * gst_mikey_message_to_bytes (GstMIKEYMessage *msg
,GstMIKEYEncryptInfo *info
,GError **error
);
Convert msg
to a GBytes.
|
a GstMIKEYMessage |
|
a GstMIKEYEncryptInfo |
|
a GError |
Returns : |
a new GBytes for msg . |
Since 1.4
typedef enum { GST_MIKEY_PRF_MIKEY_1 = 0 } GstMIKEYPRFFunc;
The PRF function that has been/will be used for key derivation
typedef enum { GST_MIKEY_MAP_TYPE_SRTP = 0 } GstMIKEYMapType;
Specifies the method of uniquely mapping Crypto Sessions to the security protocol sessions.
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
.
|
a GstMIKEYMessage |
|
a version |
|
a GstMIKEYType |
|
verify flag |
|
the GstMIKEYPRFFunc function to use |
|
the Crypto Session Bundle id |
|
the GstMIKEYCSIDMapType |
Returns : |
TRUE on success |
Since 1.4
guint gst_mikey_message_get_n_cs (const GstMIKEYMessage *msg
);
Get the number of crypto sessions in msg
.
|
a GstMIKEYMessage |
Returns : |
the number of crypto sessions |
Since 1.4
typedef struct { guint8 policy; guint32 ssrc; guint32 roc; } GstMIKEYMapSRTP;
The Security policy Map item for SRTP
const GstMIKEYMapSRTP * gst_mikey_message_get_cs_srtp (const GstMIKEYMessage *msg
,guint idx
);
Get the policy information of msg
at idx
.
|
a GstMIKEYMessage |
|
an index |
Returns : |
a GstMIKEYMapSRTP |
Since 1.4
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.
|
a GstMIKEYMessage |
|
the index to insert at |
|
the map info |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_remove_cs_srtp (GstMIKEYMessage *msg
,gint idx
);
Remove the SRTP policy at idx
.
|
a GstMIKEYMessage |
|
the index to remove |
Returns : |
TRUE on success |
Since 1.4
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
.
|
a GstMIKEYMessage |
|
the index to insert at |
|
the map info |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_add_cs_srtp (GstMIKEYMessage *msg
,guint8 policy
,guint32 ssrc
,guint32 roc
);
Add a Crypto policy for SRTP to msg
.
|
a GstMIKEYMessage |
|
The security policy applied for the stream with ssrc
|
|
the SSRC that must be used for the stream |
|
current rollover counter |
Returns : |
TRUE on success |
Since 1.4
guint gst_mikey_message_get_n_payloads (const GstMIKEYMessage *msg
);
Get the number of payloads in msg
.
|
a GstMIKEYMessage |
Returns : |
the number of payloads in msg
|
Since 1.4
const GstMIKEYPayload * gst_mikey_message_get_payload (const GstMIKEYMessage *msg
,guint idx
);
Get the GstMIKEYPayload at idx
in msg
|
a GstMIKEYMessage |
|
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
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
.
|
a GstMIKEYMessage |
|
a GstMIKEYPayloadType |
|
payload to find |
Returns : |
the nth GstMIKEYPayload of type . |
Since 1.4
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
.
|
a GstMIKEYMessage |
|
an index |
|
a GstMIKEYPayload. [transfer full] |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_remove_payload (GstMIKEYMessage *msg
,guint idx
);
Remove the payload in msg
at idx
|
a GstMIKEYMessage |
|
an index |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_replace_payload (GstMIKEYMessage *msg
,guint idx
,GstMIKEYPayload *payload
);
Replace the payload at idx
in msg
with payload
.
|
a GstMIKEYMessage |
|
an index |
|
a GstMIKEYPayload. [transfer full] |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_add_payload (GstMIKEYMessage *msg
,GstMIKEYPayload *payload
);
Add a new payload to msg
.
|
a GstMIKEYMessage |
|
a GstMIKEYPayload. [transfer full] |
Returns : |
TRUE on success |
Since 1.4
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.
Last payload | |
Key data transport payload | |
Envelope data payload | |
DH data payload | |
Signature payload | |
Timestamp payload | |
ID payload | |
Certificate Payload | |
Cert hash payload | |
Verfication message payload | |
Security Policy payload | |
RAND payload | |
Error payload | |
Key data sub-payload | |
General Extension Payload |
struct GstMIKEYPayload { GstMiniObject mini_object; GstMIKEYPayloadType type; guint len; };
Hold the common fields for all payloads
GstMIKEYPayloadType |
the payload type |
guint |
length of the payload |
GstMIKEYPayload * gst_mikey_payload_new (GstMIKEYPayloadType type
);
Make a new GstMIKEYPayload with type
.
|
a GstMIKEYPayloadType |
Returns : |
a new GstMIKEYPayload or NULL on failure. [nullable]
|
Since 1.4
GstMIKEYPayload * gst_mikey_payload_copy (const GstMIKEYPayload *buf
);
Create a copy of the given payload.
|
a GstMIKEYPayload. |
Returns : |
a new copy of payload . [transfer full]
|
Since 1.4
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
typedef enum { GST_MIKEY_MAC_NULL = 0, GST_MIKEY_MAC_HMAC_SHA_1_160 = 1 } GstMIKEYMacAlg;
Specifies the authentication algorithm used
typedef struct { GstMIKEYPayload pt; GstMIKEYEncAlg enc_alg; GstMIKEYMacAlg mac_alg; GArray *subpayloads; } GstMIKEYPayloadKEMAC;
A structure holding the KEMAC payload
GstMIKEYPayload |
the common GstMIKEYPayload |
GstMIKEYEncAlg |
the GstMIKEYEncAlg |
GstMIKEYMacAlg |
the GstMIKEYMacAlg |
GArray * |
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.
|
a GstMIKEYPayload |
|
the GstMIKEYEncAlg |
|
a GstMIKEYMacAlg |
Returns : |
TRUE on success |
Since 1.4
typedef enum { GST_MIKEY_CACHE_NONE = 0, GST_MIKEY_CACHE_ALWAYS = 1, GST_MIKEY_CACHE_FOR_CSB = 2 } GstMIKEYCacheType;
The different cache types
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 |
the common GstMIKEYPayload |
envelope key cache indicator | |
guint16 |
length of data
|
guint8 * |
the encrypted envelope key |
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
.
|
a GstMIKEYPayload |
|
envelope key cache indicator |
|
the length of data
|
|
the encrypted envelope key. [array length=data_len] |
Returns : |
TRUE on success |
Since 1.4
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.
|
a GstMIKEYMessage |
|
envelope key cache indicator |
|
the length of data
|
|
the encrypted envelope key. [array length=data_len] |
Returns : |
TRUE on success |
Since 1.4
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.
typedef struct { GstMIKEYPayload pt; GstMIKEYTSType type; guint8 *ts_value; } GstMIKEYPayloadT;
The timestamp payload carries the timestamp information
GstMIKEYPayload |
the payload header |
GstMIKEYTSType |
a GstMIKEYTSType |
guint8 * |
the timestamp value |
gboolean gst_mikey_payload_t_set (GstMIKEYPayload *payload
,GstMIKEYTSType type
,const guint8 *ts_value
);
Set the timestamp in a GST_MIKEY_PT_T
payload
.
|
a GstMIKEYPayload |
|
the GstMIKEYTSType |
|
the timestamp value. [array] |
Returns : |
TRUE on success |
Since 1.4
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.
|
a GstMIKEYMessage |
|
specifies the timestamp type used |
|
The timestamp value of the specified type . [array]
|
Returns : |
TRUE on success |
Since 1.4
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.
|
a GstMIKEYMessage |
Returns : |
TRUE on success |
Since 1.4
typedef struct { GstMIKEYPayload pt; guint8 len; guint8 *rand; } GstMIKEYPayloadRAND;
The RAND payload consists of a (pseudo-)random bit-string
GstMIKEYPayload |
the payload header |
guint8 |
the length of rand
|
guint8 * |
random values |
gboolean gst_mikey_payload_rand_set (GstMIKEYPayload *payload
,guint8 len
,const guint8 *rand
);
Set the random values in a GST_MIKEY_PT_RAND
payload
.
|
a GstMIKEYPayload |
|
the length of rand
|
|
random values. [array length=len] |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_add_rand (GstMIKEYMessage *msg
,guint8 len
,const guint8 *rand
);
Add a new RAND payload to msg
with the given parameters.
|
a GstMIKEYMessage |
|
the length of rand
|
|
random data. [array length=len] |
Returns : |
TRUE on success |
Since 1.4
gboolean gst_mikey_message_add_rand_len (GstMIKEYMessage *msg
,guint8 len
);
Add a new RAND payload to msg
with len
random bytes.
|
a GstMIKEYMessage |
|
length |
Returns : |
TRUE on success |
Since 1.4
typedef enum { GST_MIKEY_SEC_PROTO_SRTP = 0 } GstMIKEYSecProto;
Specifies the security protocol
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
Encryption algorithm | |
Session Encr. key length | |
Authentication algorithm | |
Session Auth. key length | |
Session Salt key length | |
SRTP Pseudo Random Function | |
Key derivation rate | |
SRTP encryption off/on, 0 if off, 1 if on | |
SRTCP encryption off/on, 0 if off, 1 if on | |
sender's FEC order | |
SRTP authentication off/on, 0 if off, 1 if on | |
Authentication tag length | |
SRTP prefix length |
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 |
the payload header |
guint |
the policy number |
GstMIKEYSecProto |
the security protocol |
GArray * |
array of GstMIKEYPayloadPSParam |
typedef struct { guint8 type; guint8 len; guint8 *val; } GstMIKEYPayloadSPParam;
A Type/Length/Value field for security paramaters
gboolean gst_mikey_payload_sp_set (GstMIKEYPayload *payload
,guint policy
,GstMIKEYSecProto proto
);
Set the Security Policy parameters for payload
.
|
a GstMIKEYPayload |
|
the policy number |
|
a GstMIKEYSecProto |
Returns : |
TRUE on success |
Since 1.4
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
.
|
a GstMIKEYPayload |
Returns : |
the number of parameters in payload
|
Since 1.4
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
.
|
a GstMIKEYPayload |
|
an index |
Returns : |
the GstMIKEYPayloadSPParam at idx in payload
|
Since 1.4
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
.
|
a GstMIKEYPayload |
|
a type |
|
a length |
|
len bytes of data. [array length=len]
|
Returns : |
TRUE on success |
Since 1.4
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
.
|
a GstMIKEYPayload |
|
an index |
Returns : |
TRUE on success |
Since 1.4