Skip to content

Commit

Permalink
Update x509.go
Browse files Browse the repository at this point in the history
compatible with 1.4
  • Loading branch information
emmansun authored Jun 29, 2021
1 parent 0469562 commit b66f1b4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions smx509/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -1889,12 +1889,18 @@ func CreateCertificate(rand io.Reader, template, parent *x509.Certificate, pub,
type privateKey interface {
Equal(crypto.PublicKey) bool
}
if privPub, ok := key.Public().(privateKey); !ok {
return nil, errors.New("x509: internal error: supported public key does not implement Equal")
} else if parent.PublicKey != nil && !privPub.Equal(parent.PublicKey) {

/*
if privPub, ok := key.Public().(privateKey); !ok {
return nil, errors.New("x509: internal error: supported public key does not implement Equal")
} else if parent.PublicKey != nil && !privPub.Equal(parent.PublicKey) {
return nil, errors.New("x509: provided PrivateKey doesn't match parent's PublicKey")
}
*/
if privPub, ok := key.Public().(privateKey); ok && parent.PublicKey != nil && !privPub.Equal(parent.PublicKey) {
return nil, errors.New("x509: provided PrivateKey doesn't match parent's PublicKey")
}

extensions, err := buildExtensions(template, bytes.Equal(asn1Subject, emptyASN1Subject), authorityKeyId)
if err != nil {
return nil, err
Expand Down

0 comments on commit b66f1b4

Please sign in to comment.