2016-03-04 05:14:55 -05:00
|
|
|
package arm
|
|
|
|
|
|
|
|
import (
|
2016-04-21 19:50:03 -04:00
|
|
|
"testing"
|
2018-01-22 20:21:10 -05:00
|
|
|
|
|
|
|
"golang.org/x/crypto/ssh"
|
2016-03-04 05:14:55 -05:00
|
|
|
)
|
|
|
|
|
2016-04-21 19:50:03 -04:00
|
|
|
func TestFart(t *testing.T) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-03-04 05:14:55 -05:00
|
|
|
func TestAuthorizedKeyShouldParse(t *testing.T) {
|
|
|
|
testSubject, err := NewOpenSshKeyPairWithSize(512)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to create a new OpenSSH key pair, err=%s.", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
authorizedKey := testSubject.AuthorizedKey()
|
|
|
|
|
|
|
|
_, _, _, _, err = ssh.ParseAuthorizedKey([]byte(authorizedKey))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to parse the authorized key, err=%s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPrivateKeyShouldParse(t *testing.T) {
|
|
|
|
testSubject, err := NewOpenSshKeyPairWithSize(512)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to create a new OpenSSH key pair, err=%s.", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = ssh.ParsePrivateKey([]byte(testSubject.PrivateKey()))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to parse the private key, err=%s\n", err)
|
|
|
|
}
|
|
|
|
}
|