1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00
srs/trunk/src/app/srs_app_rtc_dtls.hpp

77 lines
2.1 KiB
C++
Raw Normal View History

2020-03-06 15:01:48 +00:00
/**
* The MIT License (MIT)
*
* Copyright (c) 2013-2020 Winlin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
2020-05-11 04:07:55 +00:00
#ifndef SRS_APP_RTC_DTLS_HPP
#define SRS_APP_RTC_DTLS_HPP
2020-03-06 15:01:48 +00:00
#include <srs_core.hpp>
#include <string>
2020-04-03 07:03:09 +00:00
class SrsRequest;
2020-03-06 15:01:48 +00:00
#include <openssl/ssl.h>
2020-06-24 12:03:21 +00:00
class SrsDtlsCertificate
2020-03-06 15:01:48 +00:00
{
private:
std::string fingerprint;
2020-06-24 12:03:21 +00:00
bool ecdsa_mode;
X509* dtls_cert;
EVP_PKEY* dtls_pkey;
EC_KEY* eckey;
2020-06-24 12:03:21 +00:00
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;
2020-03-06 15:01:48 +00:00
private:
SrsDtls();
virtual ~SrsDtls();
public:
static SrsDtls* instance();
2020-06-24 10:03:09 +00:00
SSL_CTX* build_dtls_ctx();
2020-03-06 15:01:48 +00:00
};
#endif