Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for CertOrKeyExist (0.13 sec)

  1. cmd/kubeadm/app/phases/certs/certs.go

    func LoadCertificateAuthority(pkiDir string, baseName string) (*x509.Certificate, crypto.Signer, error) {
    	// Checks if certificate authority exists in the PKI directory
    	if !pkiutil.CertOrKeyExist(pkiDir, baseName) {
    		return nil, nil, errors.Errorf("couldn't load %s certificate authority from %s", baseName, pkiDir)
    	}
    
    	// Try to load certificate authority .crt and .key from the PKI directory
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Dec 05 10:17:14 UTC 2023
    - 19.4K bytes
    - Viewed (0)
  2. cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go

    			path:     tmpdir,
    			name:     "foo-1",
    			expected: true,
    		},
    	}
    	for _, rt := range tests {
    		t.Run(rt.name, func(t *testing.T) {
    			actual := CertOrKeyExist(rt.path, rt.name)
    			if actual != rt.expected {
    				t.Errorf(
    					"failed CertOrKeyExist:\n\texpected: %t\n\t  actual: %t",
    					rt.expected,
    					actual,
    				)
    			}
    		})
    	}
    }
    
    func TestTryLoadCertAndKeyFromDisk(t *testing.T) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 31 21:49:21 UTC 2024
    - 22.5K bytes
    - Viewed (0)
  3. cmd/kubeadm/app/util/pkiutil/pki_helpers.go

    		return errors.Wrapf(err, "unable to write public key to file %s", publicKeyPath)
    	}
    
    	return nil
    }
    
    // CertOrKeyExist returns a boolean whether the cert or the key exists
    func CertOrKeyExist(pkiPath, name string) bool {
    	certificatePath, privateKeyPath := PathsForCertAndKey(pkiPath, name)
    
    	_, certErr := os.Stat(certificatePath)
    	_, keyErr := os.Stat(privateKeyPath)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 01 16:01:49 UTC 2024
    - 25.5K bytes
    - Viewed (0)
Back to top