2020-01-06 16:36:49 -05:00
|
|
|
package dtl
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"golang.org/x/crypto/ssh"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFart(t *testing.T) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2020-03-10 03:16:38 -04:00
|
|
|
_, err = ssh.ParsePrivateKey(testSubject.PrivateKey())
|
2020-01-06 16:36:49 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Failed to parse the private key, err=%s\n", err)
|
|
|
|
}
|
|
|
|
}
|