Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: rtc_base/opensslidentity.h

Issue 3010363002: Implement GetChain for OpenSSLCertificate.
Patch Set: Adding unit tests and clean up. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « rtc_base/BUILD.gn ('k') | rtc_base/opensslidentity.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rtc_base/opensslidentity.h
diff --git a/rtc_base/opensslidentity.h b/rtc_base/opensslidentity.h
index e4a790e48e89c49cebefa68781f114c07fdf333b..a294d9d144558243d6ef2988d0e6f6d902a8026d 100644
--- a/rtc_base/opensslidentity.h
+++ b/rtc_base/opensslidentity.h
@@ -16,6 +16,7 @@
#include <memory>
#include <string>
+#include <vector>
#include "rtc_base/checks.h"
#include "rtc_base/constructormagic.h"
@@ -36,8 +37,7 @@ class OpenSSLKeyPair {
static OpenSSLKeyPair* Generate(const KeyParams& key_params);
// Constructs a key pair from the private key PEM string. This must not result
// in missing public key parameters. Returns null on error.
- static OpenSSLKeyPair* FromPrivateKeyPEMString(
- const std::string& pem_string);
+ static OpenSSLKeyPair* FromPrivateKeyPEMString(const std::string& pem_string);
virtual ~OpenSSLKeyPair();
@@ -62,9 +62,10 @@ class OpenSSLKeyPair {
class OpenSSLCertificate : public SSLCertificate {
public:
// Caller retains ownership of the X509 object.
- explicit OpenSSLCertificate(X509* x509) : x509_(x509) {
- AddReference();
- }
+ explicit OpenSSLCertificate(X509* x509);
+
+ // Caller retains owership of STACK_OF(X509).
+ explicit OpenSSLCertificate(STACK_OF(X509) * chain);
static OpenSSLCertificate* Generate(OpenSSLKeyPair* key_pair,
const SSLIdentityParams& params);
@@ -75,6 +76,7 @@ class OpenSSLCertificate : public SSLCertificate {
OpenSSLCertificate* GetReference() const override;
X509* x509() const { return x509_; }
+ X509* GetX509Reference() const;
std::string ToPEMString() const override;
void ToDER(Buffer* der_buffer) const override;
@@ -100,9 +102,11 @@ class OpenSSLCertificate : public SSLCertificate {
int64_t CertificateExpirationTime() const override;
private:
- void AddReference() const;
+ void AddReference(X509* x509) const;
X509* x509_;
+ // Non-leaf certificate chain.
+ std::vector<SSLCertificate*> cert_chain_;
RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate);
};
@@ -141,7 +145,6 @@ class OpenSSLIdentity : public SSLIdentity {
RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity);
};
-
} // namespace rtc
#endif // RTC_BASE_OPENSSLIDENTITY_H_
« no previous file with comments | « rtc_base/BUILD.gn ('k') | rtc_base/opensslidentity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698