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

Side by Side Diff: webrtc/base/sslidentity.h

Issue 1468273004: Provide method for returning certificate expiration timestamp. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Misc CL cleanups Created 5 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Gets the name of the digest algorithm that was used to compute this 62 // Gets the name of the digest algorithm that was used to compute this
63 // certificate's signature. 63 // certificate's signature.
64 virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const = 0; 64 virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const = 0;
65 65
66 // Compute the digest of the certificate given algorithm 66 // Compute the digest of the certificate given algorithm
67 virtual bool ComputeDigest(const std::string& algorithm, 67 virtual bool ComputeDigest(const std::string& algorithm,
68 unsigned char* digest, 68 unsigned char* digest,
69 size_t size, 69 size_t size,
70 size_t* length) const = 0; 70 size_t* length) const = 0;
71
72 // Returns the time in milliseconds relative to epoch.
hbos 2015/11/25 15:21:45 Is it unambiguous what "epoch" means? Could you wr
torbjorng (webrtc) 2015/11/25 19:14:09 https://en.wikipedia.org/wiki/Unix_time
73 virtual int64_t CertificateExpirationTime() const = 0;
71 }; 74 };
72 75
73 // SSLCertChain is a simple wrapper for a vector of SSLCertificates. It serves 76 // SSLCertChain is a simple wrapper for a vector of SSLCertificates. It serves
74 // primarily to ensure proper memory management (especially deletion) of the 77 // primarily to ensure proper memory management (especially deletion) of the
75 // SSLCertificate pointers. 78 // SSLCertificate pointers.
76 class SSLCertChain { 79 class SSLCertChain {
77 public: 80 public:
78 // These constructors copy the provided SSLCertificate(s), so the caller 81 // These constructors copy the provided SSLCertificate(s), so the caller
79 // retains ownership. 82 // retains ownership.
80 explicit SSLCertChain(const std::vector<SSLCertificate*>& certs); 83 explicit SSLCertChain(const std::vector<SSLCertificate*>& certs);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // TODO(hbos): Remove once rtc::KeyType (to be modified) and 164 // TODO(hbos): Remove once rtc::KeyType (to be modified) and
162 // blink::WebRTCKeyType (to be landed) match. By using this function in Chromium 165 // blink::WebRTCKeyType (to be landed) match. By using this function in Chromium
163 // appropriately we can change KeyType enum -> class without breaking Chromium. 166 // appropriately we can change KeyType enum -> class without breaking Chromium.
164 KeyType IntKeyTypeFamilyToKeyType(int key_type_family); 167 KeyType IntKeyTypeFamilyToKeyType(int key_type_family);
165 168
166 // Parameters for generating a certificate. If |common_name| is non-empty, it 169 // Parameters for generating a certificate. If |common_name| is non-empty, it
167 // will be used for the certificate's subject and issuer name, otherwise a 170 // will be used for the certificate's subject and issuer name, otherwise a
168 // random string will be used. 171 // random string will be used.
169 struct SSLIdentityParams { 172 struct SSLIdentityParams {
170 std::string common_name; 173 std::string common_name;
171 int not_before; // offset from current time in seconds. 174 int not_before; // Absolute time since epoch in seconds.
172 int not_after; // offset from current time in seconds. 175 int not_after; // Absolute time since epoch in seconds.
hbos 2015/11/25 15:21:45 What happens at the wrap-around date (code using t
torbjorng (webrtc) 2015/11/25 19:14:09 I'll change this to time_t, which is more kosher (
173 KeyParams key_params; 176 KeyParams key_params;
174 }; 177 };
175 178
176 // Our identity in an SSL negotiation: a keypair and certificate (both 179 // Our identity in an SSL negotiation: a keypair and certificate (both
177 // with the same public key). 180 // with the same public key).
178 // This too is pretty much immutable once created. 181 // This too is pretty much immutable once created.
179 class SSLIdentity { 182 class SSLIdentity {
180 public: 183 public:
181 // Generates an identity (keypair and self-signed certificate). If 184 // Generates an identity (keypair and self-signed certificate). If
182 // common_name is non-empty, it will be used for the certificate's 185 // common_name is non-empty, it will be used for the certificate's
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 size_t length); 220 size_t length);
218 }; 221 };
219 222
220 extern const char kPemTypeCertificate[]; 223 extern const char kPemTypeCertificate[];
221 extern const char kPemTypeRsaPrivateKey[]; 224 extern const char kPemTypeRsaPrivateKey[];
222 extern const char kPemTypeEcPrivateKey[]; 225 extern const char kPemTypeEcPrivateKey[];
223 226
224 } // namespace rtc 227 } // namespace rtc
225 228
226 #endif // WEBRTC_BASE_SSLIDENTITY_H_ 229 #endif // WEBRTC_BASE_SSLIDENTITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698