{"record":{"id":"13503cd9b1cad083","repo":"kubernetes/kops","slug":"error-parsing-ssh-public-key-v-13503c","errorCode":null,"errorMessage":"error parsing SSH public key: %v","messagePattern":"error parsing SSH public key: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sshcredentials/fingerprint.go","lineNumber":30,"sourceCode":"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\npackage sshcredentials\n\nimport (\n\t\"bytes\"\n\t\"crypto/md5\"\n\t\"fmt\"\n\n\t\"golang.org/x/crypto/ssh\"\n)\n\nfunc Fingerprint(pubkey string) (string, error) {\n\tsshPublicKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(pubkey))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error parsing SSH public key: %v\", err)\n\t}\n\n\t// compute fingerprint to serve as id\n\th := md5.New()\n\t_, err = h.Write(sshPublicKey.Marshal())\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error fingerprinting SSH public key: %v\", err)\n\t}\n\tid := formatFingerprint(h.Sum(nil))\n\treturn id, nil\n}\n\nfunc formatFingerprint(data []byte) string {\n\tvar buf bytes.Buffer\n\n\tfor i, b := range data {\n\t\ts := fmt.Sprintf(\"%0.2x\", b)\n\t\tif i != 0 {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/sshcredentials/fingerprint.go#L12-L48","documentation":"Fingerprint calls ssh.ParseAuthorizedKey on the admin SSH public key read from the state store; the key is not a valid OpenSSH authorized-key line (truncated, wrong format such as bare RFC4716 headers, or corrupt bytes), so no MD5 fingerprint can be computed.","triggerScenarios":"Thrown at pkg/sshcredentials/fingerprint.go:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-import a valid key: `kops create secret sshpublickey admin -i ~/.ssh/id_rsa.pub`","Ensure the key is a single-line OpenSSH public key (ssh-rsa/ssh-ed25519 ... comment), not a private key or multiline PEM","Delete the corrupt secret first with `kops delete secret sshpublickey admin` if replacing it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}