return
}
- asn1Issuer, err := asn1.Marshal(parent.Issuer.ToRDNSequence())
+ asn1Issuer, err := asn1.Marshal(parent.Subject.ToRDNSequence())
if err != nil {
return
}
- asn1Subject, err := asn1.Marshal(parent.Subject.ToRDNSequence())
+ asn1Subject, err := asn1.Marshal(template.Subject.ToRDNSequence())
if err != nil {
return
}
return
}
+ commonName := "test.example.com"
template := Certificate{
SerialNumber: big.NewInt(1),
Subject: pkix.Name{
- CommonName: "test.example.com",
+ CommonName: commonName,
Organization: []string{"Acme Co"},
},
NotBefore: time.SecondsToUTC(1000),
t.Errorf("Failed to parse name constraints: %#v", cert.PermittedDNSDomains)
}
+ if cert.Subject.CommonName != commonName {
+ t.Errorf("Subject wasn't correctly copied from the template. Got %s, want %s", cert.Subject.CommonName, commonName)
+ }
+
+ if cert.Issuer.CommonName != commonName {
+ t.Errorf("Issuer wasn't correctly copied from the template. Got %s, want %s", cert.Issuer.CommonName, commonName)
+ }
+
err = cert.CheckSignatureFrom(cert)
if err != nil {
t.Errorf("Signature verification failed: %s", err)