Exemplo n.º 1
0
// CertStore method returns handle to certificate store in certain CSP context
func (c Ctx) CertStore(name string) (res CertStore, err error) {
	cName := charPtr(name)
	defer freePtr(cName)

	res.hStore = C.openStoreSystem(c.hProv, cName)
	if res.hStore == nil {
		err = getErr("Error getting system cert store")
		return
	}
	return
}
Exemplo n.º 2
0
// CertStore method returns handle to certificate store in certain CSP context
func (c *Ctx) CertStore(name string) (*CertStore, error) {
	var res CertStore
	cName := charPtr(name)
	defer freePtr(cName)

	res.hStore = C.openStoreSystem(c.hProv, cName)
	if res.hStore == C.HCERTSTORE(nil) {
		return &res, getErr("Error getting system cert store")
	}
	return &res, nil
}
Exemplo n.º 3
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
}
Exemplo n.º 4
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
}