OpenFFmpeg
Classes | Macros | Typedefs | Functions | Variables
rtmpcrypt.c File Reference

RTMPE protocol. More...

#include "libavutil/blowfish.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/rc4.h"
#include "libavutil/xtea.h"
#include "internal.h"
#include "rtmp.h"
#include "rtmpdh.h"
#include "rtmpcrypt.h"
#include "url.h"

Classes

struct  RTMPEContext
 

Macros

#define OFFSET(x)   offsetof(RTMPEContext, x)
 
#define DEC   AV_OPT_FLAG_DECODING_PARAM
 

Typedefs

typedef struct RTMPEContext RTMPEContext
 

Functions

int ff_rtmpe_gen_pub_key (URLContext *h, uint8_t *buf)
 Initialize the Diffie-Hellmann context and generate the public key. More...
 
int ff_rtmpe_compute_secret_key (URLContext *h, const uint8_t *serverdata, const uint8_t *clientdata, int type)
 Compute the shared secret key and initialize the RC4 encryption. More...
 
void ff_rtmpe_encrypt_sig (URLContext *h, uint8_t *sig, const uint8_t *digest, int type)
 Encrypt the signature. More...
 
int ff_rtmpe_update_keystream (URLContext *h)
 Update the keystream and set RC4 keys for encryption. More...
 

Variables

const URLProtocol ff_ffrtmpcrypt_protocol
 

Detailed Description

RTMPE protocol.

Function Documentation

§ ff_rtmpe_compute_secret_key()

int ff_rtmpe_compute_secret_key ( URLContext h,
const uint8_t *  serverdata,
const uint8_t *  clientdata,
int  type 
)

Compute the shared secret key and initialize the RC4 encryption.

Parameters
han URLContext
serverdataserver data (1536 bytes)
clientdataclient data (1536 bytes)
typethe position of the server digest
Returns
zero on success, negative value otherwise

§ ff_rtmpe_encrypt_sig()

void ff_rtmpe_encrypt_sig ( URLContext h,
uint8_t *  signature,
const uint8_t *  digest,
int  type 
)

Encrypt the signature.

Parameters
han URLContext
signaturethe signature to encrypt
digestthe digest used for finding the encryption key
typetype of encryption (8 for XTEA, 9 for Blowfish)

§ ff_rtmpe_gen_pub_key()

int ff_rtmpe_gen_pub_key ( URLContext h,
uint8_t *  buf 
)

Initialize the Diffie-Hellmann context and generate the public key.

Parameters
han URLContext
bufhandshake data (1536 bytes)
Returns
zero on success, negative value otherwise

§ ff_rtmpe_update_keystream()

int ff_rtmpe_update_keystream ( URLContext h)

Update the keystream and set RC4 keys for encryption.

Parameters
han URLContext
Returns
zero on success, negative value otherwise

Variable Documentation

§ ff_ffrtmpcrypt_protocol

const URLProtocol ff_ffrtmpcrypt_protocol
Initial value:
= {
.name = "ffrtmpcrypt",
.url_open = rtmpe_open,
.url_read = rtmpe_read,
.url_write = rtmpe_write,
.url_close = rtmpe_close,
.priv_data_size = sizeof(RTMPEContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &ffrtmpcrypt_class,
}
Definition: rtmpcrypt.c:42