Skip to content

Instantly share code, notes, and snippets.

View AZ-X's full-sized avatar
🏠
restricted IOT anytime, even slow conn to github. All right to the community

AZ-X

🏠
restricted IOT anytime, even slow conn to github. All right to the community
View GitHub Profile
@AZ-X
AZ-X / quiz-CECPQ2.md
Last active May 12, 2021 10:51
CECPQ2 support for golang 1.16

quiz

insert

==>

const ( CurveCECPQ2 CurveID = 16696 )

@AZ-X
AZ-X / root_windows.go
Last active February 18, 2021 15:34
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)
...
}
@AZ-X
AZ-X / os_windows.go
Last active December 12, 2020 11:06
golang-stdlib RNG migration for Windows
_BCryptGenRandom stdFunction
var bcryptdll = []byte("Bcrypt.dll\000")
bcrypt := windowsLoadSystemLib(bcryptdll)
if bcrypt == 0 {
throw("Bcrypt.dll not found")
}
_BCryptGenRandom = windowsFindfunc(bcrypt, []byte("BCryptGenRandom\000"))