|
|
@ -36,8 +36,8 @@ const ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
sshOpLocker = sync.Mutex{} |
|
|
|
sshOpLocker = sync.Mutex{} |
|
|
|
SSH_UNKNOWN_KEY_TYPE = fmt.Errorf("unknown key type") |
|
|
|
SSHUnknownKeyType = fmt.Errorf("unknown key type") |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type KeyType int |
|
|
|
type KeyType int |
|
|
@ -186,7 +186,7 @@ func SSHKeyGenParsePublicKey(key string) (string, int, error) { |
|
|
|
return "", 0, fmt.Errorf("public key check failed with error '%s': %s", err, stderr) |
|
|
|
return "", 0, fmt.Errorf("public key check failed with error '%s': %s", err, stderr) |
|
|
|
} |
|
|
|
} |
|
|
|
if strings.HasSuffix(stdout, "is not a public key file.") { |
|
|
|
if strings.HasSuffix(stdout, "is not a public key file.") { |
|
|
|
return "", 0, SSH_UNKNOWN_KEY_TYPE |
|
|
|
return "", 0, SSHUnknownKeyType |
|
|
|
} |
|
|
|
} |
|
|
|
fields := strings.Split(stdout, " ") |
|
|
|
fields := strings.Split(stdout, " ") |
|
|
|
if len(fields) < 4 { |
|
|
|
if len(fields) < 4 { |
|
|
@ -216,7 +216,7 @@ func SSHNativeParsePublicKey(keyLine string) (string, int, error) { |
|
|
|
pkey, err := ssh.ParsePublicKey(raw) |
|
|
|
pkey, err := ssh.ParsePublicKey(raw) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if strings.HasPrefix(err.Error(), "ssh: unknown key algorithm") { |
|
|
|
if strings.HasPrefix(err.Error(), "ssh: unknown key algorithm") { |
|
|
|
return "", 0, SSH_UNKNOWN_KEY_TYPE |
|
|
|
return "", 0, SSHUnknownKeyType |
|
|
|
} |
|
|
|
} |
|
|
|
return "", 0, err |
|
|
|
return "", 0, err |
|
|
|
} |
|
|
|
} |
|
|
|