mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: refine dtls certificate
This commit is contained in:
parent
0bf0a61401
commit
f3f9636d80
5 changed files with 100 additions and 53 deletions
|
@ -32,25 +32,45 @@ class SrsRequest;
|
|||
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
class SrsDtlsCertificate
|
||||
{
|
||||
private:
|
||||
std::string fingerprint;
|
||||
bool ecdsa_mode;
|
||||
X509* dtls_cert;
|
||||
EVP_PKEY* dtls_pkey;
|
||||
EC_KEY* eckey;
|
||||
public:
|
||||
SrsDtlsCertificate();
|
||||
virtual ~SrsDtlsCertificate();
|
||||
public:
|
||||
// Initialize DTLS certificate.
|
||||
srs_error_t initialize();
|
||||
// dtls_cert
|
||||
X509* get_cert();
|
||||
// public key
|
||||
EVP_PKEY* get_public_key();
|
||||
// ECDSA key
|
||||
EC_KEY* get_ecdsa_key();
|
||||
// certificate fingerprint
|
||||
std::string get_fingerprint();
|
||||
// whether is ecdsa
|
||||
bool is_ecdsa();
|
||||
};
|
||||
|
||||
// @global dtls certficate for rtc module.
|
||||
SrsDtlsCertificate* _rtc_dtls_certificate = new SrsDtlsCertificate();
|
||||
|
||||
class SrsDtls
|
||||
{
|
||||
private:
|
||||
static SrsDtls* _instance;
|
||||
private:
|
||||
std::string fingerprint;
|
||||
X509* dtls_cert;
|
||||
EVP_PKEY* dtls_pkey;
|
||||
EC_KEY* eckey;
|
||||
private:
|
||||
SrsDtls();
|
||||
virtual ~SrsDtls();
|
||||
public:
|
||||
srs_error_t init(SrsRequest* r);
|
||||
public:
|
||||
static SrsDtls* instance();
|
||||
SSL_CTX* build_dtls_ctx();
|
||||
public:
|
||||
std::string get_fingerprint() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue