Ejemplo n.º 1
0
// SystemStore returns handle to certificate store with certain name, using
// default system cryptoprovider
func SystemStore(name string) (res CertStore, err error) {
	cName := C.CString(name)
	defer C.free(unsafe.Pointer(cName))

	res.hStore = C.openStoreSystem(C.HCRYPTPROV(0), (*C.CHAR)(cName))
	if res.hStore == C.HCERTSTORE(nil) {
		err = getErr("Error getting system cert store")
		return
	}
	return
}
Ejemplo n.º 2
0
// SystemStore returns handle to certificate store with certain name, using
// default system cryptoprovider
func SystemStore(name string) (*CertStore, error) {
	var res CertStore
	cName := unsafe.Pointer(C.CString(name))
	defer C.free(cName)

	res.hStore = C.openStoreSystem(C.HCRYPTPROV(0), (*C.CHAR)(cName))
	if res.hStore == C.HCERTSTORE(nil) {
		return &res, getErr("Error getting system cert store")
	}
	return &res, nil
}