go.crypto/ssh: introduce Signer method, an abstraction of

private keys.

R=agl, jpsugar, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/13338044
This commit is contained in:
Han-Wen Nienhuys
2013-09-19 14:45:31 -04:00
committed by Adam Langley
parent 28dc961a18
commit 934c14ffe9
9 changed files with 394 additions and 250 deletions
+3 -9
View File
@@ -1,8 +1,6 @@
package test
import (
"crypto/x509"
"encoding/pem"
"reflect"
"strings"
"testing"
@@ -171,16 +169,12 @@ func testAuthorizedKeys(t *testing.T, authKeys []byte, expected []authResult) {
}
func getTestPublicKey(t *testing.T) ssh.PublicKey {
block, _ := pem.Decode([]byte(testClientPrivateKey))
if block == nil {
t.Fatalf("pem.Decode: %v", testClientPrivateKey)
}
priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
priv, err := ssh.ParsePrivateKey([]byte(testClientPrivateKey))
if err != nil {
t.Fatalf("x509.ParsePKCS1PrivateKey: %v", err)
t.Fatalf("ParsePrivateKey: %v", err)
}
return ssh.NewRSAPublicKey(&priv.PublicKey)
return priv.PublicKey()
}
func TestAuth(t *testing.T) {