Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for DualUseCommonName (0.24 sec)

  1. security/pkg/pki/util/dual_use.go

    // limitations under the License.
    
    package util
    
    import (
    	"fmt"
    	"strings"
    )
    
    // DualUseCommonName extracts a valid CommonName from a comma-delimited host string
    // for dual-use certificates.
    func DualUseCommonName(host string) (string, error) {
    	// cn uses one hostname, drop the rest
    	first := strings.SplitN(host, ",", 2)[0]
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 29 20:42:01 UTC 2020
    - 1.1K bytes
    - Viewed (0)
  2. security/pkg/pki/util/dual_use_test.go

    			expectedCN: "a.com",
    		},
    		{
    			name:      "long host",
    			host:      strings.Repeat("a", 61) + ".com",
    			expectErr: true,
    		},
    	}
    
    	for _, tc := range tt {
    		cn, err := DualUseCommonName(tc.host)
    		if tc.expectErr {
    			if err == nil {
    				t.Errorf("[%s] passed - expected error", tc.name)
    			}
    			continue
    		}
    
    		if err != nil {
    			t.Errorf("[%s] unexpected error: %v", tc.name, err)
    		}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 29 20:42:01 UTC 2020
    - 1.4K bytes
    - Viewed (0)
  3. security/pkg/pki/util/generate_cert.go

    	}
    	exts := []pkix.Extension{*ext}
    
    	subject := pkix.Name{}
    	// Dual use mode if common name in CSR is not empty.
    	// In this case, set CN as determined by DualUseCommonName(subjectIDsInString).
    	if len(csr.Subject.CommonName) != 0 {
    		if cn, err := DualUseCommonName(subjectIDsInString); err != nil {
    			// log and continue
    			log.Errorf("dual-use failed for cert template - omitting CN (%v)", err)
    		} else {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Aug 02 14:34:38 UTC 2023
    - 14.2K bytes
    - Viewed (0)
  4. security/pkg/pki/util/generate_csr.go

    		},
    	}
    
    	if h := options.Host; len(h) > 0 {
    		s, err := BuildSubjectAltNameExtension(h)
    		if err != nil {
    			return nil, err
    		}
    		if options.IsDualUse {
    			cn, err := DualUseCommonName(h)
    			if err != nil {
    				// log and continue
    				log.Errorf("dual-use failed for CSR template - omitting CN (%v)", err)
    			} else {
    				template.Subject.CommonName = cn
    			}
    		}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Nov 06 12:48:53 UTC 2023
    - 4.1K bytes
    - Viewed (0)
Back to top