X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=common.go;h=fbafd56ab680de6afc61eb50f41890e1ed1babfc;hb=cae1bf7a68f5be04942cdb96f91e5eca44232f5c;hp=b87133a59a2ca80c6c16182b5a0c998ecd18029d;hpb=1f0e56f6a94ab99ef3b46eb1b07f65c802f508c0;p=govpn.git diff --git a/common.go b/common.go index b87133a..fbafd56 100644 --- a/common.go +++ b/common.go @@ -19,8 +19,6 @@ along with this program. If not, see . package govpn import ( - "encoding/hex" - "io/ioutil" "log" "os" "os/exec" @@ -54,25 +52,6 @@ func ScriptCall(path, ifaceName string) ([]byte, error) { return out, err } -// Read authentication key from the file. -// Key is 64 hexadecimal chars long. -func KeyRead(path string) *[KeySize]byte { - keyData, err := ioutil.ReadFile(path) - if err != nil { - panic("Unable to read keyfile: " + err.Error()) - } - if len(keyData) < 64 { - panic("Key must be 64 hex characters long") - } - keyDecoded, err := hex.DecodeString(string(keyData[0:64])) - if err != nil { - panic("Unable to decode the key: " + err.Error()) - } - key := new([KeySize]byte) - copy(key[:], keyDecoded) - return key -} - // Zero each byte func sliceZero(data []byte) { for i := 0; i < len(data); i++ {