caCertTemplate := &x509.Certificate{
SerialNumber: 1,
IsCA: true,
NotBefore: time.Now(),
Subject: pkix.Name{ExtraNames: pkixAttrTypeValue},
NotAfter: time.Now().AddDate(10, 0, 0),
KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,
}
when I inspect the created certificate using asn1parse -in <PathToPemFile>
31:d=4 hl=2 l= 13 cons: SEQUENCE
33:d=5 hl=2 l= 3 prim: OBJECT :commonName
38:d=5 hl=2 l= 6 prim: PRINTABLESTRING :golang
the common name is PRINTABLESTRING and not the UTF8STRING.
As i understand, golang strings are utf8 default then why it is not UTF8STRING ?
However, in above code when i use below to create certificate
subjectExtraNames = append(subjectExtraNames, pkix.AttributeTypeAndValue{Type: COMMON_NAME, Value: "é um"})
and when I inspect certificate then it shows UTF8STRING for é um"
If this is how it is then is there a way to get a string without special characters as UTF8STRING in certificate?