https://github.com/kayrus/putty
Go package to parse PuTTY private key formats
https://github.com/kayrus/putty
golang golang-package ppk private-key putty ssh-keys
Last synced: 10 months ago
JSON representation
Go package to parse PuTTY private key formats
- Host: GitHub
- URL: https://github.com/kayrus/putty
- Owner: kayrus
- License: apache-2.0
- Created: 2019-05-29T05:08:59.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T17:17:02.000Z (almost 2 years ago)
- Last Synced: 2024-12-11T12:24:53.370Z (over 1 year ago)
- Topics: golang, golang-package, ppk, private-key, putty, ssh-keys
- Language: Go
- Size: 46.9 KB
- Stars: 24
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# putty


Go package to parse PuTTY private key formats. Go 1.23 or above is required.
## Example
```go
package main
import (
"log"
"github.com/kayrus/putty"
)
func main() {
var privateKey interface{}
// read the key
puttyKey, err := putty.NewFromFile("test.ppk")
if err != nil {
log.Fatal(err)
}
// parse putty key
if puttyKey.Encryption != "none" {
// If the key is encrypted, decrypt it
privateKey, err = puttyKey.ParseRawPrivateKey([]byte("testkey"))
if err != nil {
log.Fatal(err)
}
} else {
privateKey, err = puttyKey.ParseRawPrivateKey(nil)
if err != nil {
log.Fatal(err)
}
}
log.Printf("%+#v", privateKey)
}
```