Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for BuildSubjectAltNameExtension (0.28 sec)

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

    // the type of the identity.
    type Identity struct {
    	Type  IdentityType
    	Value []byte
    }
    
    // BuildSubjectAltNameExtension builds the SAN extension for the certificate.
    func BuildSubjectAltNameExtension(hosts string) (*pkix.Extension, error) {
    	ids := []Identity{}
    	for _, host := range strings.Split(hosts, ",") {
    		if ipa, _ := netip.ParseAddr(host); ipa.IsValid() {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Oct 14 06:50:22 UTC 2022
    - 6K bytes
    - Viewed (0)
  2. security/pkg/pki/util/generate_csr.go

    	template := &x509.CertificateRequest{
    		Subject: pkix.Name{
    			Organization: []string{options.Org},
    		},
    	}
    
    	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
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Nov 06 12:48:53 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  3. security/pkg/pki/util/generate_cert.go

    		extKeyUsages = append(extKeyUsages, x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth)
    	}
    
    	// Build cert extensions with the subjectIDs.
    	ext, err := BuildSubjectAltNameExtension(subjectIDsInString)
    	if err != nil {
    		return nil, err
    	}
    	exts := []pkix.Extension{*ext}
    
    	subject := pkix.Name{}
    	// Dual use mode if common name in CSR is not empty.
    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/san_test.go

    			expectedExt: getSANExtension([]Identity{uriIdentity, ipIdentity, dnsIdentity}, t),
    		},
    	}
    
    	for id, tc := range testCases {
    		if ext, err := BuildSubjectAltNameExtension(tc.hosts); err != nil {
    			t.Errorf("Case %q: a unexpected error has been encountered (error: %v)", id, err)
    		} else if !reflect.DeepEqual(ext, tc.expectedExt) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Feb 12 17:36:33 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  5. security/pkg/pki/ca/ca_test.go

    		san := util.ExtractSANExtension(cert.Extensions)
    		if san == nil {
    			t.Errorf("%s: No SAN extension is found in the certificate", id)
    		}
    		expected, err := util.BuildSubjectAltNameExtension(subjectID)
    		if err != nil {
    			t.Errorf("%s: BuildSubjectAltNameExtension error: %v", id, err)
    		}
    		if !reflect.DeepEqual(expected, san) {
    			t.Errorf("%s: Unexpected extensions: wanted %v but got %v", id, expected, san)
    		}
    	}
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 31 08:51:27 UTC 2023
    - 29.1K bytes
    - Viewed (0)
Back to top