Пример #1
0
// NewCertFromFile Load loads a Cert from files
func NewCertFromFile(filename string) (*Cert, error) {
	_, err := os.Stat(filename)
	if os.IsNotExist(err) {
		return nil, ErrCertNotFound
	}

	cFilename := C.CString(filename)
	defer C.free(unsafe.Pointer(cFilename))

	cert := C.zcert_load(cFilename)
	return &Cert{
		zcertT: cert,
	}, nil
}
Пример #2
0
// NewCertFromFile Load loads a Cert from files
func NewCertFromFile(filename string) (*Cert, error) {
	cert := C.zcert_load(C.CString(filename))
	return &Cert{
		zcertT: cert,
	}, nil
}