Пример #1
0
// MemoryStore returns handle to new empty in-memory certificate store
func MemoryStore() (res CertStore, err error) {
	res.hStore = C.openStoreMem()
	if res.hStore == C.HCERTSTORE(nil) {
		err = getErr("Error creating memory cert store")
		return
	}
	return
}
Пример #2
0
// MemoryStore returns handle to new empty in-memory certificate store
func MemoryStore() (*CertStore, error) {
	var res CertStore
	res.hStore = C.openStoreMem()
	if res.hStore == C.HCERTSTORE(nil) {
		return &res, getErr("Error creating memory cert store")
	}
	return &res, nil
}
Пример #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
}
Пример #4
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
}
Пример #5
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
}