LEFT | RIGHT |
(no file at all) | |
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 "encoding/base64" | 8 "encoding/base64" |
9 "errors" | 9 "errors" |
10 "io" | 10 "io" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 case *failureAgentMsg: | 199 case *failureAgentMsg: |
200 return nil, errors.New("ssh: failed to list keys") | 200 return nil, errors.New("ssh: failed to list keys") |
201 } | 201 } |
202 return nil, UnexpectedMessageError{agentIdentitiesAnswer, msgType} | 202 return nil, UnexpectedMessageError{agentIdentitiesAnswer, msgType} |
203 } | 203 } |
204 | 204 |
205 // SignRequest requests the signing of data by the agent using a protocol 2 key | 205 // SignRequest requests the signing of data by the agent using a protocol 2 key |
206 // as defined in [PROTOCOL.agent] section 2.6.2. | 206 // as defined in [PROTOCOL.agent] section 2.6.2. |
207 func (ac *AgentClient) SignRequest(key interface{}, data []byte) ([]byte, error)
{ | 207 func (ac *AgentClient) SignRequest(key interface{}, data []byte) ([]byte, error)
{ |
208 req := marshal(agentSignRequest, signRequestAgentMsg{ | 208 req := marshal(agentSignRequest, signRequestAgentMsg{ |
209 » » KeyBlob: serializePublickey(key), | 209 » » KeyBlob: serializePublicKey(key), |
210 Data: data, | 210 Data: data, |
211 }) | 211 }) |
212 | 212 |
213 msg, msgType, err := ac.sendAndReceive(req) | 213 msg, msgType, err := ac.sendAndReceive(req) |
214 if err != nil { | 214 if err != nil { |
215 return nil, err | 215 return nil, err |
216 } | 216 } |
217 | 217 |
218 switch msg := msg.(type) { | 218 switch msg := msg.(type) { |
219 case *signResponseAgentMsg: | 219 case *signResponseAgentMsg: |
(...skipping 21 matching lines...) Expand all Loading... |
241 case agentSignResponse: | 241 case agentSignResponse: |
242 msg = new(signResponseAgentMsg) | 242 msg = new(signResponseAgentMsg) |
243 default: | 243 default: |
244 return nil, 0, UnexpectedMessageError{0, packet[0]} | 244 return nil, 0, UnexpectedMessageError{0, packet[0]} |
245 } | 245 } |
246 if err := unmarshal(msg, packet, packet[0]); err != nil { | 246 if err := unmarshal(msg, packet, packet[0]); err != nil { |
247 return nil, 0, err | 247 return nil, 0, err |
248 } | 248 } |
249 return msg, packet[0], nil | 249 return msg, packet[0], nil |
250 } | 250 } |
LEFT | RIGHT |