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

Delta Between Two Patch Sets: ssh/keys.go

Issue 14540051: code review 14540051: go.crypto/ssh: Add certificate verification, step up su... (Closed)
Left Patch Set: diff -r 812c06b5a384 https://code.google.com/p/go.crypto Created 10 years, 5 months ago
Right Patch Set: diff -r 5ff5636e18c9 https://code.google.com/p/go.crypto Created 10 years, 5 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « ssh/certs_test.go ('k') | ssh/keys_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 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 package ssh 5 package ssh
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "crypto" 9 "crypto"
10 "crypto/dsa" 10 "crypto/dsa"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 in = rest 95 in = rest
96 continue 96 continue
97 } 97 }
98 98
99 i := bytes.IndexAny(in, " \t") 99 i := bytes.IndexAny(in, " \t")
100 if i == -1 { 100 if i == -1 {
101 in = rest 101 in = rest
102 continue 102 continue
103 } 103 }
104 104
105 » » field := string(in[:i]) 105 » » if out, comment, ok = parseAuthorizedKey(in[i:]); ok {
106 » » if isAcceptableAlgo(field) { 106 » » » return
107 » » » if out, comment, ok = parseAuthorizedKey(in[i:]); ok {
108 » » » » return
109 » » » }
110 } 107 }
111 108
112 // No key type recognised. Maybe there's an options field at 109 // No key type recognised. Maybe there's an options field at
113 // the beginning. 110 // the beginning.
114 var b byte 111 var b byte
115 inQuote := false 112 inQuote := false
116 var candidateOptions []string 113 var candidateOptions []string
117 optionStart := 0 114 optionStart := 0
118 for i, b = range in { 115 for i, b = range in {
119 isEnd := !inQuote && (b == ' ' || b == '\t') 116 isEnd := !inQuote && (b == ' ' || b == '\t')
(...skipping 19 matching lines...) Expand all
139 continue 136 continue
140 } 137 }
141 138
142 in = in[i:] 139 in = in[i:]
143 i = bytes.IndexAny(in, " \t") 140 i = bytes.IndexAny(in, " \t")
144 if i == -1 { 141 if i == -1 {
145 in = rest 142 in = rest
146 continue 143 continue
147 } 144 }
148 145
149 » » field = string(in[:i]) 146 » » if out, comment, ok = parseAuthorizedKey(in[i:]); ok {
150 » » if isAcceptableAlgo(field) { 147 » » » options = candidateOptions
151 » » » if out, comment, ok = parseAuthorizedKey(in[i:]); ok { 148 » » » return
152 » » » » options = candidateOptions
153 » » » » return
154 » » » }
155 } 149 }
156 150
157 in = rest 151 in = rest
158 continue 152 continue
159 } 153 }
160 154
161 return 155 return
162 } 156 }
163 157
164 // ParsePublicKey parses an SSH public key formatted for use in 158 // ParsePublicKey parses an SSH public key formatted for use in
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 Parameters: dsa.Parameters{ 600 Parameters: dsa.Parameters{
607 P: k.P, 601 P: k.P,
608 Q: k.Q, 602 Q: k.Q,
609 G: k.G, 603 G: k.G,
610 }, 604 },
611 Y: k.Priv, 605 Y: k.Priv,
612 }, 606 },
613 X: k.Pub, 607 X: k.Pub,
614 }, nil 608 }, nil
615 } 609 }
LEFTRIGHT

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