Golang crypto/x509.KeyUsage type example
package crypto/x509
Golang crypto/x509.KeyUsage type usage example
template := x509.Certificate{
SerialNumber: serialNumber,
Subject: pkix.Name{
Organization: []string{organization},
},
NotBefore: now.Add(-time.Hour * 24),
NotAfter: validUntil,
// KeyUsage for template
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
IsCA: true, // so can sign self.
BasicConstraintsValid: true,
}
Reference :
Advertisement
Something interesting
Tutorials
+9.9k Golang : Translate language with language package example
+26k Golang : Convert IP address string to long ( unsigned 32-bit integer )
+9.2k Golang : How to check if a string with spaces in between is numeric?
+11.6k SSL : The certificate is not trusted because no issuer chain was provided
+9.1k Golang : Get curl -I or head data from URL example
+7.3k Golang : Of hash table and hash map
+7.7k Golang : How to execute code at certain day, hour and minute?
+18k Golang : How to log each HTTP request to your web server?
+5.2k JavaScript/JQuery : Redirect page examples
+30.4k Golang : Generate random string
+4.7k Javascript : Access JSON data example