Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv interface{}) (cert []byte, err error) {
<...>
publicKeyBytes, publicKeyAlgorithm, err := marshalPublicKey(pub)
if err != nil {
return nil, err
}
privKeyBytes, _, err := marshalPublicKey(&priv.PublicKey)
if err != nil {
return nil, err
}
<...>
if !bytes.Equal(publicKeyBytes, privKeyBytes) && len(parent.SubjectKeyId) > 0 {
template.AuthorityKeyId = parent.SubjectKeyId
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment