Update Go API to version 1.2

Add Certificate Object, support parse, check and access (very limited)
attributes of an X.509 certificate in PEM format.
This commit is contained in:
Zhi Guan
2018-07-15 10:54:52 +08:00
parent a0e5d103ba
commit 27940499bc
7 changed files with 169 additions and 45 deletions

View File

@@ -7,7 +7,6 @@ package gmssl
import "C"
import (
"errors"
"unsafe"
)
@@ -19,7 +18,7 @@ func SeedRandom(seed []byte) error {
func GenerateRandom(length int) ([]byte, error) {
outbuf := make([]byte, length)
if C.RAND_bytes((*C.uchar)(&outbuf[0]), C.int(length)) <= 0 {
return nil, errors.New("GmSSL Failure")
return nil, GetErrors()
}
return outbuf[:length], nil