Documentation
¶
Overview ¶
Package kc provides functions for encoding/decoding darwin user passwords, for use in the /etc/kcpassword file. This is essentially a go port of http://www.brock-family.org/gavin/perl/kcpassword.html
Index ¶
- Variables
- func AutoLoginPassword() (password []byte, err error)
- func AutoLoginUser() (user string, password []byte, err error)
- func AutoLoginUsername() (user string, err error)
- func Decode(encoded []byte) []byte
- func Encode(password []byte) []byte
- func LoginWindowPList() (data map[string]interface{}, err error)
- func SetAutoLogin(user string, password []byte) (err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MagicKey = []byte{0x7D, 0x89, 0x52, 0x23, 0xD2, 0xBC, 0xDD, 0xEA, 0xA3, 0xB9, 0x1F}
)
Functions ¶
func AutoLoginPassword ¶
func AutoLoginUser ¶
func AutoLoginUsername ¶
func Decode ¶
Example ¶
package main
import (
"fmt"
"github.com/taskcluster/generic-worker/kc"
)
func main() {
// Check case of no bytes after 0 byte terminator (password (12*n-1) bytes
// for integer n, n > 0)
fmt.Println(string(kc.Decode(kc.Encode([]byte("fredmary123")))))
// Check case of trailing bytes after 0 byte terminator (password not
// (12*n-1) bytes for integer n, n > 0)
fmt.Println(string(kc.Decode(kc.Encode([]byte("fredmary1234")))))
}
Output: fredmary123 fredmary1234
func Encode ¶
Example ¶
package main
import (
"fmt"
"github.com/taskcluster/generic-worker/kc"
)
func main() {
fmt.Printf("%x\n", kc.Encode([]byte(`mysecretpassword`)))
// 11 byte password should be 12 bytes when encoded
fmt.Printf("%x\n", kc.Encode([]byte(`fredmary123`)))
// 12 byte password should be 24 bytes when encoded (since encoded
// passwords should always be a multiple of 12 bytes, but trailing
// 0 byte is included in encoding, so 12 byte password is stored
// as 13 bytes, meaning 24 bytes are needed not 12).
fmt.Printf("%x\n", kc.Encode([]byte(`fredmary1234`)))
fmt.Printf("%x\n", kc.Encode([]byte(`12345!@#$%{}PO"we[]{*&$!#+^ffdSWrhd4b#`)))
}
Output: 10f02146b1ceb89ed3d86c0efe3d51b6bcddeaa3b91f7d89 1bfb3747bfddaf93928b2c7d 1bfb3747bfddaf93928b2c49895223d2bcddeaa3b91f7d89 4cbb6117e79d9dc9879c6400d91d01a5d986b7d8933959a871088cdabb8ef0ee6d15ed6641f1bcddeaa3b91f7d895223
func LoginWindowPList ¶
func SetAutoLogin ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.