Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1207)

Side by Side Diff: src/pkg/crypto/x509/x509.go

Issue 1704044: code review 1704044: strings and bytes.Split: make count of 0 mean 0, not in... (Closed)
Patch Set: code review 1704044: strings and bytes.Split: make count of 0 mean 0, not in... Created 14 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/bytes/bytes_test.go ('k') | src/pkg/exec/exec.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This package parses X.509-encoded keys and certificates. 5 // This package parses X.509-encoded keys and certificates.
6 package x509 6 package x509
7 7
8 import ( 8 import (
9 "asn1" 9 "asn1"
10 "big" 10 "big"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 digest := h.Sum() 400 digest := h.Sum()
401 401
402 return rsa.VerifyPKCS1v15(pub, hashType, digest, c.Signature) 402 return rsa.VerifyPKCS1v15(pub, hashType, digest, c.Signature)
403 } 403 }
404 404
405 func matchHostnames(pattern, host string) bool { 405 func matchHostnames(pattern, host string) bool {
406 if len(pattern) == 0 || len(host) == 0 { 406 if len(pattern) == 0 || len(host) == 0 {
407 return false 407 return false
408 } 408 }
409 409
410 » patternParts := strings.Split(pattern, ".", 0) 410 » patternParts := strings.Split(pattern, ".", -1)
411 » hostParts := strings.Split(host, ".", 0) 411 » hostParts := strings.Split(host, ".", -1)
412 412
413 if len(patternParts) != len(hostParts) { 413 if len(patternParts) != len(hostParts) {
414 return false 414 return false
415 } 415 }
416 416
417 for i, patternPart := range patternParts { 417 for i, patternPart := range patternParts {
418 if patternPart == "*" { 418 if patternPart == "*" {
419 continue 419 continue
420 } 420 }
421 if patternPart != hostParts[i] { 421 if patternPart != hostParts[i] {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 return 811 return
812 } 812 }
813 813
814 cert, err = asn1.MarshalToMemory(certificate{ 814 cert, err = asn1.MarshalToMemory(certificate{
815 c, 815 c,
816 algorithmIdentifier{oidSHA1WithRSA}, 816 algorithmIdentifier{oidSHA1WithRSA},
817 asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, 817 asn1.BitString{Bytes: signature, BitLength: len(signature) * 8},
818 }) 818 })
819 return 819 return
820 } 820 }
OLDNEW
« no previous file with comments | « src/pkg/bytes/bytes_test.go ('k') | src/pkg/exec/exec.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b