示例#1
0
// findCerts returns slice of *Cert's in store that satisfy findType and findPara
func (s CertStore) findCerts(findType C.DWORD, findPara unsafe.Pointer) []Cert {
	var res []Cert

	for pCert := C.CertFindCertificateInStore(s.hStore, C.MY_ENC_TYPE, 0, findType, findPara, nil); pCert != nil; pCert = C.CertFindCertificateInStore(s.hStore, C.MY_ENC_TYPE, 0, findType, findPara, pCert) {
		pCertDup := C.CertDuplicateCertificateContext(pCert)
		res = append(res, Cert{pCertDup})
	}
	return res
}
示例#2
0
// getCert returns first of Cert's in store that satisfy findType and findPara
func (s CertStore) getCert(findType C.DWORD, findPara unsafe.Pointer) C.PCCERT_CONTEXT {
	return C.CertFindCertificateInStore(s.hStore, C.MY_ENC_TYPE, 0, findType, findPara, nil)
}
示例#3
0
// GetCert returns first of Cert's in store that satisfy findType and findPara
func (s *CertStore) GetCert(findType C.DWORD, findPara unsafe.Pointer) *Cert {
	if pCert := C.CertFindCertificateInStore(s.hStore, C.MY_ENC_TYPE, 0, findType, findPara, nil); pCert != nil {
		return &Cert{pCert}
	}
	return nil
}