Golang crypto/x509/pkix.TBSCertificateList example
package crypto/x509/pkix
TBSCertificateList represents the ASN.1 structure of the same name. See RFC 5280, section 5.1.
Golang crypto/x509/pkix.TBSCertificateList usage example
cert, _ := x509.ParseCertificate(block.Bytes)
now := time.Unix(1000, 0)
expiry := time.Unix(10000, 0)
revokedCerts := []pkix.RevokedCertificate{
{
SerialNumber: big.NewInt(1),
RevocationTime: now,
},
{
SerialNumber: big.NewInt(42),
RevocationTime: now,
},
}
tbsCertList := pkix.TBSCertificateList{
Version: 2,
Signature: pkix.AlgorithmIdentifier{
Algorithm: oidSignatureSHA1WithRSA,
},
Issuer: cert.Subject.ToRDNSequence(),
ThisUpdate: now.UTC(),
NextUpdate: expiry.UTC(),
RevokedCertificates: revokedCerts,
}
Reference :
Advertisement
Something interesting
Tutorials
+14k Golang : Reverse IP address for reverse DNS lookup example
+6.2k Golang : Process non-XML/JSON formatted ASCII text file example
+19.7k Golang : Archive directory with tar and gzip
+15k Golang : package is not in GOROOT during compilation
+11.6k Golang : Convert(cast) float to int
+11.7k Golang : Gorilla web tool kit secure cookie example
+10.3k Golang : Wait and sync.WaitGroup example
+7.6k Golang : Convert(cast) io.Reader type to string
+10.6k Golang : How to unmarshal JSON inner/nested value and assign to specific struct?
+9.9k Golang : Function wrapper that takes arguments and return result example
+30.4k Golang : Generate random string
+8.3k Golang : Oanda bot with Telegram and RSI example