func findPrivateKey()

in sks_windows.go [125:145]


func findPrivateKey(label string) (tpm.Key, error) {
	certStore, err := tpm.OpenWinCertStore(
		keyStorageProvider,
		label,
		[]string{},
		[]string{},
	)
	if err != nil {
		return nil, err
	}
	key, err := certStore.Key()
	if err != nil {
		// Windows will return an error with the specified content if the key was not
		// found.
		if strings.Contains(err.Error(), errKeyDoesNotExist) {
			return nil, nil
		}
		return nil, err
	}
	return key, nil
}