Exemplo n.º 1
0
Arquivo: main.go Projeto: cycps/addie
func loadSpiCert() error {

	cert, err := ioutil.ReadFile("/cypress/" + user + "/spi.cert")
	if err != nil {
		log.Println(err)
		return fmt.Errorf("spi cert read failure")
	}

	err = spi.SetCertificate(cert)
	if err != nil {
		log.Println(err)
		return fmt.Errorf("failed to set go-spi session cert")
	}

	return nil

}
Exemplo n.º 2
0
func LoadCert() {

	localUser, err := user.Current()
	if err != nil {
		Fatal(fmt.Sprintf("could not get current user: %v", err))
	}

	spiDir := localUser.HomeDir + "/.spi"

	cert, err := ioutil.ReadFile(spiDir + "/spi.cert")
	if err != nil {
		Fatal("certificate read failed")
	}

	spi.SetCertificate(cert)

}