switched to eliptical strategy

This commit is contained in:
0xdcarns
2022-01-29 15:02:37 -05:00
parent 2d703dce7c
commit 410efbab50
10 changed files with 234 additions and 161 deletions

View File

@@ -93,14 +93,21 @@ func RetrieveSecret(network string) (string, error) {
}
// StoreTrafficKey - stores traffic key
func StoreTrafficKey(key string, network string) error {
return os.WriteFile(ncutils.GetNetclientPathSpecific()+"traffic-"+network, []byte(key), 0600)
func StoreTrafficKey(key *[32]byte, network string) error {
var data, err = ncutils.ConvertKeyToBytes(key)
if err != nil {
return err
}
return os.WriteFile(ncutils.GetNetclientPathSpecific()+"traffic-"+network, data, 0600)
}
// RetrieveTrafficKey - reads traffic file locally
func RetrieveTrafficKey(network string) (string, error) {
dat, err := os.ReadFile(ncutils.GetNetclientPathSpecific() + "traffic-" + network)
return string(dat), err
func RetrieveTrafficKey(network string) (*[32]byte, error) {
data, err := os.ReadFile(ncutils.GetNetclientPathSpecific() + "traffic-" + network)
if err != nil {
return nil, err
}
return ncutils.ConvertBytesToKey(data)
}
// Configuraion - struct for mac and pass