Golang crypto/x509/pkix.Name type example
package crypto/x509/pkix
Name represents an X.509 distinguished name. This only includes the common elements of a DN. Additional elements in the name are ignored.
Golang crypto/x509/pkix.Name type usage example
template := x509.Certificate {
Subject : pkix.Name{
Country : []string{"Earth"},
Organization: []string{"Mother Nature"},
OrganizationalUnit: []string{"Solar System"},
Locality: []string{""},
Province: []string{""},
StreetAddress: []string{"Solar System"},
PostalCode: []string{"Planet # 3"},
SerialNumber: "123",
CommonName: "Gaia",
},
IsCA : true,
BasicConstraintsValid : true,
SubjectKeyId : []byte{1,2,3},
SerialNumber : big.NewInt(1234),
NotBefore : time.Now(),
NotAfter : time.Now().AddDate(5,5,5),
// see http://golang.org/pkg/crypto/x509/#KeyUsage
ExtKeyUsage : []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
KeyUsage : x509.KeyUsageDigitalSignature|x509.KeyUsageCertSign,
}
Reference :
https://www.socketloop.com/references/golang-crypto-x509-certpool-addcert-function-example
Advertisement
Something interesting
Tutorials
+9.1k Golang : Simple histogram example
+7.1k Golang : Transform lisp or spinal case to Pascal case example
+8.1k Golang : HTTP Server Example
+8.4k Golang : Ackermann function example
+30.6k Golang : Remove characters from string example
+33.8k Golang : convert(cast) bytes to string
+7.5k Golang : Get YouTube playlist
+17.2k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+6.7k Golang : Output or print out JSON stream/encoded data
+6.8k Swift : substringWithRange() function example
+8.1k Golang : Tell color name with OpenCV example