You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
441 B

package main
import (
"encoding/json"
"io/ioutil"
ownrsa "./ownrsa"
)
func readKeys(path string) []ownrsa.PackRSA {
var keys []ownrsa.PackRSA
file, err := ioutil.ReadFile(path)
check(err)
content := string(file)
json.Unmarshal([]byte(content), &keys)
return keys
}
func saveKeys(keys []ownrsa.PackRSA, path string) {
jsonKeys, err := json.Marshal(keys)
check(err)
err = ioutil.WriteFile(path, jsonKeys, 0644)
check(err)
}