Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 635526892
  • Loading branch information
CertoToStore Team authored and copybara-github committed May 20, 2024
1 parent 8d76313 commit 1629256
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions certtostore_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ func (w *WinCertStore) Cert() (*x509.Certificate, error) {
// such as looking up the private key with CertKey().
//
// You must call FreeCertContext on the context after use.
func (w *WinCertStore) CertWithContext() (*x509.Certificate, *windows.CertContext, error) {
c, ctx, err := w.cert(w.issuers, my, w.storeDomain())
func (w *WinCertStore) CertWithContext(prev ...*windows.CertContext) (*x509.Certificate, *windows.CertContext, error) {
c, ctx, err := w.cert(w.issuers, my, w.storeDomain(), prev...)
if err != nil {
return nil, nil, err
}
Expand All @@ -455,13 +455,18 @@ func (w *WinCertStore) CertWithContext() (*x509.Certificate, *windows.CertContex

// cert is a helper function to lookup certificates based on a known issuer.
// store is used to specify which store to perform the lookup in (system or user).
func (w *WinCertStore) cert(issuers []string, searchRoot *uint16, store uint32) (*x509.Certificate, *windows.CertContext, error) {
func (w *WinCertStore) cert(issuers []string, searchRoot *uint16, store uint32, prevCtx ...*windows.CertContext) (*x509.Certificate, *windows.CertContext, error) {
h, err := w.storeHandle(store, searchRoot)
if err != nil {
return nil, nil, err
}

var prev *windows.CertContext

if len(prevCtx) == 1 {
prev = prevCtx[0]
}

var cert *x509.Certificate
for _, issuer := range issuers {
i, err := windows.UTF16PtrFromString(issuer)
Expand Down

0 comments on commit 1629256

Please sign in to comment.