1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #ifndef RTC_BASE_RTC_CERTIFICATE_H_
- #define RTC_BASE_RTC_CERTIFICATE_H_
- #include <stdint.h>
- #include <memory>
- #include <string>
- #include "api/scoped_refptr.h"
- #include "rtc_base/ref_count.h"
- #include "rtc_base/system/rtc_export.h"
- namespace rtc {
- class SSLCertChain;
- class SSLCertificate;
- class SSLIdentity;
- class RTCCertificatePEM {
- public:
- RTCCertificatePEM(const std::string& private_key,
- const std::string& certificate)
- : private_key_(private_key), certificate_(certificate) {}
- const std::string& private_key() const { return private_key_; }
- const std::string& certificate() const { return certificate_; }
- private:
- std::string private_key_;
- std::string certificate_;
- };
- class RTC_EXPORT RTCCertificate : public RefCountInterface {
- public:
-
- static scoped_refptr<RTCCertificate> Create(
- std::unique_ptr<SSLIdentity> identity);
-
- uint64_t Expires() const;
-
-
- bool HasExpired(uint64_t now) const;
- const SSLCertificate& GetSSLCertificate() const;
- const SSLCertChain& GetSSLCertificateChain() const;
-
- const SSLCertificate& ssl_certificate() const;
-
-
-
-
- SSLIdentity* identity() const { return identity_.get(); }
-
- RTCCertificatePEM ToPEM() const;
-
- static scoped_refptr<RTCCertificate> FromPEM(const RTCCertificatePEM& pem);
- bool operator==(const RTCCertificate& certificate) const;
- bool operator!=(const RTCCertificate& certificate) const;
- protected:
- explicit RTCCertificate(SSLIdentity* identity);
- ~RTCCertificate() override;
- private:
-
-
- std::unique_ptr<SSLIdentity> identity_;
- };
- }
- #endif
|