Index: net/base/x509_cert_types.h |
=================================================================== |
--- net/base/x509_cert_types.h (revision 163343) |
+++ net/base/x509_cert_types.h (working copy) |
@@ -75,6 +75,11 @@ |
HashValue() : tag(HASH_VALUE_SHA1) {} |
bool Equals(const HashValue& other) const; |
+ |
+ // Parse/write in this format: "sha1/Guzek9lMwR3KeIS8wwS9gBvVtIg=" |
+ bool ParseBase64String(const std::string& input); |
+ std::string WriteBase64String() const; |
Ryan Sleevi
2012/10/25 01:59:09
I feel this is not coupled to the "HashValue" conc
unsafe
2012/10/25 06:59:54
Note that the type/base64 format is *not* the HPKP
|
+ |
size_t size() const; |
unsigned char* data(); |
const unsigned char* data() const; |
@@ -102,6 +107,18 @@ |
} |
}; |
+class NET_EXPORT HashValuesEqualPredicate { |
Ryan Sleevi
2012/10/25 01:59:09
naming nit: HashValueEquals
design nit: Is this so
unsafe
2012/10/25 06:59:54
Deleted HashValueLessThan. HashValueEqualsPredica
|
+ public: |
+ explicit HashValuesEqualPredicate(const HashValue& fingerprint) : |
+ fingerprint_(fingerprint) {} |
+ |
+ bool operator()(const HashValue& other) const { |
+ return fingerprint_.Equals(other); |
+ } |
+ |
+ const HashValue& fingerprint_; |
+}; |
+ |
typedef std::vector<HashValue> HashValueVector; |
// IsSHA1HashInSortedArray returns true iff |hash| is in |array|, a sorted |
@@ -110,6 +127,17 @@ |
const uint8* array, |
size_t array_byte_len); |
+// Returns true if the intersection of |a| and |b| is not empty. If either |
+// |a| or |b| is empty, returns false. |
+bool NET_EXPORT HashesIntersect(const HashValueVector& a, |
+ const HashValueVector& b); |
+ |
+// Convert between HashValueVector and comma-separated string format: |
+// "sha1/Guzek9lMwR3KeIS8wwS9gBvVtIg=,sha256/U8Sg... |
+std::string NET_EXPORT HashesToBase64String(const HashValueVector& hashes); |
+bool Base64StringToHashes(const std::string& hashes_str, |
+ HashValueVector* hashes); |
Ryan Sleevi
2012/10/25 01:59:09
BUG?: You don't NET_EXPORT Base64StringToHashes, t
unsafe
2012/10/25 06:59:54
Fixed.
|
+ |
// CertPrincipal represents the issuer or subject field of an X.509 certificate. |
struct NET_EXPORT CertPrincipal { |
CertPrincipal(); |