Skip to content

Instantly share code, notes, and snippets.

@AZ-X
Last active February 18, 2021 15:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AZ-X/f2bf1e4aa6704eb168b998efcc89b9b2 to your computer and use it in GitHub Desktop.
Save AZ-X/f2bf1e4aa6704eb168b998efcc89b9b2 to your computer and use it in GitHub Desktop.
golang - Secure Windows CryptoAPI calling when verifying certificate
func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
...
const CERT_CHAIN_OPT_IN_WEAK_SIGNATURE = 0x00010000 // optional checking SHA1 certificate
err = syscall.CertGetCertificateChain(syscall.Handle(0), storeCtx, verifyTime, storeCtx.Store, para, CCERT_CHAIN_OPT_IN_WEAK_SIGNATURE|CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS, 0, &topCtx)
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment