Go bindings for Windows Cryptographic APIs
The package cryptosyscall
contains (non-idiomatic) bindings for many (but not all) for the
API calls in the NCrypt* and BCrypt* suite.
So far there is one idiomatic wrapper for the data protection API, with more to come. Contributions welcome.
package main
import (
"fmt"
"github.com/grooveid/wincrypto"
)
func main() {
ciphertext, err := wincrypto.ProtectSecret([]byte("hunter2"))
if err != nil {
panic(err)
}
fmt.Printf("secret: %x\n", ciphertext)
plaintext, err := wincrypto.UnprotectSecret(ciphertext)
if err != nil {
panic(err)
}
fmt.Printf("plaintext: %s\n", string(plaintext))
}
Please do not report security issues in the issue tracker. Rather, please contact me directly at [email protected] (PGP Key 8EA205C01C425FF195A5E9A43FA0768F26FD2554
)