validator contains the default validation logic for certificate authority certificates. The only requirement here is that the certificate have a non-empty subject field.
(req *csr.CertificateRequest)
| 27 | // authority certificates. The only requirement here is that the |
| 28 | // certificate have a non-empty subject field. |
| 29 | func validator(req *csr.CertificateRequest) error { |
| 30 | if req.CN != "" { |
| 31 | return nil |
| 32 | } |
| 33 | |
| 34 | if len(req.Names) == 0 { |
| 35 | return cferr.Wrap(cferr.PolicyError, cferr.InvalidRequest, errors.New("missing subject information")) |
| 36 | } |
| 37 | |
| 38 | for i := range req.Names { |
| 39 | if csr.IsNameEmpty(req.Names[i]) { |
| 40 | return cferr.Wrap(cferr.PolicyError, cferr.InvalidRequest, errors.New("missing subject information")) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | return nil |
| 45 | } |
| 46 | |
| 47 | // New creates a new root certificate from the certificate request. |
| 48 | func New(req *csr.CertificateRequest) (cert, csrPEM, key []byte, err error) { |
searching dependent graphs…