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

Unified Diff: net/base/public_key_hashes_check.go

Issue 8770048: net: reenable Twitter's public key pins with api.twitter.com using the CDN pins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/public_key_hashes.h ('k') | net/base/transport_security_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/public_key_hashes_check.go
diff --git a/net/base/public_key_hashes_check.go b/net/base/public_key_hashes_check.go
index 142d22aed1491061b2f9500718fa73ea4a398e54..61b4bcdda3c1e5166accca33f6be376fdd9b6e62 100644
--- a/net/base/public_key_hashes_check.go
+++ b/net/base/public_key_hashes_check.go
@@ -53,6 +53,12 @@ func matchNames(name, v string) error {
if strings.HasSuffix(firstWord, ",") {
firstWord = firstWord[:len(firstWord)-1]
}
+ if pos := strings.Index(firstWord, "."); pos != -1 {
+ firstWord = firstWord[:pos]
+ }
+ if pos := strings.Index(firstWord, "-"); pos != -1 {
+ firstWord = firstWord[:pos]
+ }
if !strings.HasPrefix(v, firstWord) {
return errors.New("The first word of the certificate name isn't a prefix of the variable name")
}
@@ -135,7 +141,7 @@ func main() {
trimmed = trimmed[6 : len(trimmed)-2]
h := sha1.New()
h.Write(x509Cert.RawSubjectPublicKeyInfo)
- shouldBe := base64.StdEncoding.EncodeToString(h.Sum())
+ shouldBe := base64.StdEncoding.EncodeToString(h.Sum(nil))
if shouldBe != string(trimmed) {
fmt.Fprintf(os.Stderr, "Line %d: hash should be %s, but found %s\n", lineNo, shouldBe, trimmed)
return
« no previous file with comments | « net/base/public_key_hashes.h ('k') | net/base/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698