MCPcopy Create free account
hub / github.com/cloudflare/cfssl / validator

Function validator

initca/initca.go:29–45  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

27// authority certificates. The only requirement here is that the
28// certificate have a non-empty subject field.
29func 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.
48func New(req *csr.CertificateRequest) (cert, csrPEM, key []byte, err error) {

Callers 1

TestValidationsFunction · 0.85

Calls 2

NewFunction · 0.92
IsNameEmptyFunction · 0.92

Tested by 1

TestValidationsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…