libgpac
Documentation of the core library of GPAC
io_fcryp.c File Reference
#include <gpac/filters.h>
#include <gpac/constants.h>
#include <gpac/download.h>
#include <gpac/crypt.h>
#include <gpac/network.h>
+ Include dependency graph for io_fcryp.c:

Data Structures

struct  KeyInfo
 
struct  GF_CryptFileCtx
 

Macros

#define OFFS(_n)   #_n, offsetof(GF_CryptFileCtx, _n)
 

Enumerations

enum  {
  KEY_STATE_NONE =0 , KEY_STATE_CHANGED , KEY_STATE_DOWNLOADING , KEY_STATE_DOWNLOAD_DONE ,
  KEY_STATE_SET_IV
}
 

Functions

static GF_Err cryptfile_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
const char * gf_filter_get_src_args (GF_Filter *filter)
 
static Bool cryptfile_on_filter_setup_error (GF_Filter *failed_filter, void *udta, GF_Err err)
 
static GF_Err cryptfin_initialize (GF_Filter *filter)
 
static void cryptfile_finalize (GF_Filter *filter)
 
static GF_FilterProbeScore cryptfile_probe_url (const char *url, const char *mime_type)
 
static void cryptfile_set_key (GF_CryptFileCtx *ctx)
 
static GF_Err cryptfin_process (GF_Filter *filter)
 
const GF_FilterRegister * cryptin_register (GF_FilterSession *session)
 
void gf_cryptfin_set_kms (GF_Filter *filter, const char *key_url, bin128 key_IV)
 
void gf_filter_mirror_forced_caps (GF_Filter *filter, GF_Filter *dst_filter)
 
static GF_Err cryptfout_initialize (GF_Filter *filter)
 
static GF_Err cryptfout_process (GF_Filter *filter)
 
const GF_FilterRegister * cryptout_register (GF_FilterSession *session)
 
GF_Err gf_cryptfout_push_key (GF_Filter *filter, bin128 *key, bin128 *IV)
 

Variables

static const GF_FilterArgs CryptFinArgs []
 
static const GF_FilterCapability CryptFileCaps []
 
GF_FilterRegister CryptFinRegister
 
static const GF_FilterArgs CryptFoutArgs []
 
GF_FilterRegister CryptFoutRegister
 

Data Structure Documentation

◆ KeyInfo

struct KeyInfo
Data Fields
Bool do_crypt
bin128 key
bin128 iv

◆ GF_CryptFileCtx

struct GF_CryptFileCtx
Data Fields
char * src
char * dst
Bool fullfile
GF_FilterPid * ipid
GF_FilterPid * opid
GF_Filter * for_filter
u32 reload_key_state
char * key_url
bin128 IV
GF_Err in_error
u8 key_data[20]
u32 key_size
GF_Crypt * crypt
u8 store[16]
u32 remain
bin128 last_key
Bool use_key
Bool file_done
GF_List * keys

Macro Definition Documentation

◆ OFFS

#define OFFS (   _n)    #_n, offsetof(GF_CryptFileCtx, _n)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
KEY_STATE_NONE 
KEY_STATE_CHANGED 
KEY_STATE_DOWNLOADING 
KEY_STATE_DOWNLOAD_DONE 
KEY_STATE_SET_IV 

Function Documentation

◆ cryptfile_configure_pid()

static GF_Err cryptfile_configure_pid ( GF_Filter *  filter,
GF_FilterPid *  pid,
Bool  is_remove 
)
static
+ Here is the call graph for this function:

◆ cryptfile_on_filter_setup_error()

static Bool cryptfile_on_filter_setup_error ( GF_Filter *  failed_filter,
void *  udta,
GF_Err  err 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptfin_initialize()

static GF_Err cryptfin_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ cryptfile_finalize()

static void cryptfile_finalize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ cryptfile_probe_url()

static GF_FilterProbeScore cryptfile_probe_url ( const char *  url,
const char *  mime_type 
)
static

◆ cryptfile_set_key()

static void cryptfile_set_key ( GF_CryptFileCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cryptfin_process()

static GF_Err cryptfin_process ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ cryptin_register()

const GF_FilterRegister* cryptin_register ( GF_FilterSession *  session)

◆ gf_cryptfin_set_kms()

void gf_cryptfin_set_kms ( GF_Filter *  filter,
const char *  key_url,
bin128  key_IV 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_mirror_forced_caps()

void gf_filter_mirror_forced_caps ( GF_Filter *  filter,
GF_Filter *  dst_filter 
)
+ Here is the caller graph for this function:

◆ cryptfout_initialize()

static GF_Err cryptfout_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ cryptfout_process()

static GF_Err cryptfout_process ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ cryptout_register()

const GF_FilterRegister* cryptout_register ( GF_FilterSession *  session)

◆ gf_cryptfout_push_key()

GF_Err gf_cryptfout_push_key ( GF_Filter *  filter,
bin128 key,
bin128 IV 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ CryptFinArgs

const GF_FilterArgs CryptFinArgs[]
static
Initial value:
=
{
{ OFFS(src), "location of source file", GF_PROP_NAME, NULL, NULL, 0},
{ OFFS(fullfile), "reassemble full file before decryption", GF_PROP_BOOL, "false", NULL, GF_ARG_HINT_ADVANCED},
{0}
}
@ GF_PROP_BOOL
Definition: filters.h:858
@ GF_PROP_NAME
Definition: filters.h:884
#define GF_ARG_HINT_ADVANCED
Definition: main.h:121
#define OFFS(_n)
Definition: io_fcryp.c:347

◆ CryptFileCaps

const GF_FilterCapability CryptFileCaps[]
static
Initial value:
=
{
}
@ GF_STREAM_FILE
Definition: constants.h:104
#define GF_CAPS_OUTPUT
Definition: filters.h:2232
#define CAP_UINT(_f, _a, _b)
Definition: filters.h:2172
#define GF_CAPS_INPUT
Definition: filters.h:2220
@ GF_PROP_PID_STREAM_TYPE
Definition: filters.h:1112

◆ CryptFinRegister

GF_FilterRegister CryptFinRegister
Initial value:
= {
.name = "cryptin",
GF_FS_SET_HELP("This filter dispatch raw blocks from encrypted files with AES 128 CBC in PKCS7 to clear input files\n"
"\n"
"The filter is automatically loaded by the DASH/HLS demultiplexer and should not be explicitly loaded by your application.\n"
"\n"
"The filter accepts URL with scheme `gcryp://URL`, where `URL` is the URL to decrypt.\n"
"\n"
"The filter can process http(s) and local file key URLs (setup through HLS manifest), and expects a full key (16 bytes) as result of resource fetching.\n"
)
.private_size = sizeof(GF_CryptFileCtx),
.initialize = cryptfin_initialize,
.finalize = cryptfile_finalize,
.configure_pid = cryptfile_configure_pid,
.process = cryptfin_process,
.probe_url = cryptfile_probe_url,
.hint_class_type = GF_FS_CLASS_CRYPTO
}
#define GF_FS_SET_HELP(_help)
Definition: filters.h:2372
#define SETCAPS(__struct)
Definition: filters.h:2364
@ GF_FS_REG_ACT_AS_SOURCE
Definition: filters.h:2397
@ GF_FS_REG_EXPLICIT_ONLY
Definition: filters.h:2393
@ GF_FS_CLASS_CRYPTO
Definition: filters.h:2457
attribute Array args
Definition: jsf.idl:24
static void cryptfile_finalize(GF_Filter *filter)
Definition: io_fcryp.c:149
static GF_Err cryptfin_process(GF_Filter *filter)
Definition: io_fcryp.c:212
static GF_Err cryptfile_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
Definition: io_fcryp.c:83
static const GF_FilterArgs CryptFinArgs[]
Definition: io_fcryp.c:349
static GF_Err cryptfin_initialize(GF_Filter *filter)
Definition: io_fcryp.c:123
static GF_FilterProbeScore cryptfile_probe_url(const char *url, const char *mime_type)
Definition: io_fcryp.c:164
static const GF_FilterCapability CryptFileCaps[]
Definition: io_fcryp.c:356
Definition: io_fcryp.c:53

◆ CryptFoutArgs

const GF_FilterArgs CryptFoutArgs[]
static
Initial value:
=
{
{ OFFS(dst), "location of source file", GF_PROP_NAME, NULL, NULL, 0},
{ OFFS(fullfile), "reassemble full file before decryption", GF_PROP_BOOL, "false", NULL, GF_ARG_HINT_ADVANCED},
{0}
}

◆ CryptFoutRegister

GF_FilterRegister CryptFoutRegister
Initial value:
= {
.name = "cryptout",
GF_FS_SET_HELP("This filter dispatch raw blocks from clear input files to encrypted files with AES 128 CBC in PKCS7\n"
"\n"
"The filter is automatically loaded by the DASH/HLS multiplexer and should not be explicitly loaded by your application.\n"
"\n"
"The filter accepts URL with scheme `gcryp://URL`, where `URL` is the URL to encrypt.")
.private_size = sizeof(GF_CryptFileCtx),
.initialize = cryptfout_initialize,
.finalize = cryptfile_finalize,
.configure_pid = cryptfile_configure_pid,
.process = cryptfout_process,
.probe_url = cryptfile_probe_url,
.hint_class_type = GF_FS_CLASS_CRYPTO
}
static GF_Err cryptfout_initialize(GF_Filter *filter)
Definition: io_fcryp.c:465
static GF_Err cryptfout_process(GF_Filter *filter)
Definition: io_fcryp.c:491
static const GF_FilterArgs CryptFoutArgs[]
Definition: io_fcryp.c:636