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

Side by Side Diff: ssh/client_auth_test.go

Issue 6061052: code review 6061052: ssh: cosmetic cleanups (Closed)
Patch Set: diff -r 1ce0f2904ef1 https://agl%40golang.org@code.google.com/p/go.crypto/ Created 12 years, 11 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 | « ssh/client_auth.go ('k') | ssh/common.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 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 func (k *keychain) Sign(i int, rand io.Reader, data []byte) (sig []byte, err err or) { 79 func (k *keychain) Sign(i int, rand io.Reader, data []byte) (sig []byte, err err or) {
80 hashFunc := crypto.SHA1 80 hashFunc := crypto.SHA1
81 h := hashFunc.New() 81 h := hashFunc.New()
82 h.Write(data) 82 h.Write(data)
83 digest := h.Sum(nil) 83 digest := h.Sum(nil)
84 switch key := k.keys[i].(type) { 84 switch key := k.keys[i].(type) {
85 case *rsa.PrivateKey: 85 case *rsa.PrivateKey:
86 return rsa.SignPKCS1v15(rand, key, hashFunc, digest) 86 return rsa.SignPKCS1v15(rand, key, hashFunc, digest)
87 } 87 }
88 » return nil, errors.New("unknown key type") 88 » return nil, errors.New("ssh: unknown key type")
89 } 89 }
90 90
91 func (k *keychain) loadPEM(file string) error { 91 func (k *keychain) loadPEM(file string) error {
92 buf, err := ioutil.ReadFile(file) 92 buf, err := ioutil.ReadFile(file)
93 if err != nil { 93 if err != nil {
94 return err 94 return err
95 } 95 }
96 block, _ := pem.Decode(buf) 96 block, _ := pem.Decode(buf)
97 if block == nil { 97 if block == nil {
98 return errors.New("ssh: no key found") 98 return errors.New("ssh: no key found")
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 MACs: []string{mac}, 269 MACs: []string{mac},
270 }, 270 },
271 } 271 }
272 c, err := Dial("tcp", newMockAuthServer(t), config) 272 c, err := Dial("tcp", newMockAuthServer(t), config)
273 if err != nil { 273 if err != nil {
274 t.Fatalf("client could not authenticate with mac algo %s : %v", mac, err) 274 t.Fatalf("client could not authenticate with mac algo %s : %v", mac, err)
275 } 275 }
276 c.Close() 276 c.Close()
277 } 277 }
278 } 278 }
OLDNEW
« no previous file with comments | « ssh/client_auth.go ('k') | ssh/common.go » ('j') | no next file with comments »

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