In difficult market times like these, investors must reexamine which industry tailwinds will be unaffected. With rising inflation and the potential for a recession, many businesses dependent on consumer spending have a reason to worry. However, one area that isn't affected by that sentiment is cybersecurity.

Cybersecurity is a growing concern for businesses and customers alike. No one wants their data exposed or breached, so businesses must ensure they take every step possible to secure themselves. This makes cybersecurity stocks a great buy today, as they are being sold off with their tech brethren, even though their businesses won't likely be affected. My top three cybersecurity stocks to buy right now are CrowdStrike Holdings (CRWD -0.68%), Cloudflare (NET -0.23%), and Okta (OKTA -0.65%).

Suspicious-looking person looking like a hacker.

Image source: Getty Images.

1. CrowdStrike

My top pick of the three, CrowdStrike, provides cloud-based endpoint software that protects against breaches. With more than 20 different modules, it offers a solution for many applications.

Its software has been widely adopted, with 65 of the Fortune 100 and 15 of the top 20 banks using CrowdStrike. With more than 16,000 customers total, it has a broad reach.

For its 2022 fiscal year (ended Jan. 31), CrowdStrike grew its revenue 66% year over year to $1.45 billion while maintaining a 30.5% free cash flow margin. It is growing quickly and profitably, allowing the company to be agile when navigating complex markets or making acquisitions.

With the company projecting 48% revenue growth (at the midpoint of guidance) for its current fiscal year, the future looks bright. Investors will learn more about how CrowdStrike is managing the current environment when it reports fiscal 2023 first-quarter earnings on June 2. Until then, shareholders will need to hold on as the stock continues to fall, due only to market sentiment.

2. Cloudflare

Cloudflare isn't solely focused on cybersecurity, but it fits well within its primary offering. The company is putting up data centers worldwide so anyone can host a website on its servers. By situating the data centers physically close to customers, websites run faster. Among other things, Cloudflare offers security for these websites.

Customers will have the most up-to-date technology and top-notch security by choosing Cloudflare. With more than 154,000 customers, it is carving out an excellent market for itself.

First-quarter revenue grew 54% year over year to $212 million, while large customers (those who spend more than $100,000 annually) rose 63% to 1,537. It also posted a positive adjusted operating margin of 2% for the first time.

While not as profitable as CrowdStrike, Cloudflare is in the early stages of what it believes is a $100 billion market opportunity by 2024. With management projecting around 45% revenue growth this year, the stock's investment thesis is right on track.

Two people looking at a computer in a data center.

Image source: Getty Images.

3. Okta

Identity management is Okta's niche, and it does it both on the customer and business side. With Okta's products, IT teams can set up single sign-on and multifactor authentication for its customers' employees to ensure the correct people are accessing the right programs at the right time. Okta also allows its customers to integrate multi-factor authentication for their external customers so that accounts and personal information are protected.

In 2021, Okta acquired Auth0, allowing developers to add multifactor authentication in practically every coding language. This addition fits with Okta's product suite but skews its financial results.

In fiscal 2022 (ended Jan. 31), revenue grew 56% year over year to $1.3 billion with Auth0 and 39% to $1.16 billion without it. A key metric for Okta is remaining performance obligations (RPO), which accounts for subscription backlog. This metric tallied $2.69 billion, up 60% year over year. The company expects to realize $1.35 billion of this backlog over the next 12 months.

Without any customer additions or product expansions, Okta is already able to grow its revenue. It is a strong company in a great financial position with $2.5 billion on the balance sheet as of Jan. 31.

How are these stocks valued?

These three stocks are often seen as industry leaders. As a result, their valuations are high. But with the recent market weakness, valuations have been slashed.

CRWD PS Ratio Chart

CRWD P/S ratio. Data by YCharts.

Based on a price-to-sales (P/S) ratio, there are some interesting takeaways. Okta is the cheapest, but its market opportunity isn't as wide as the others. Cloudflare used to trade for more than 100 times sales but is now trading around 25 due solely to market sentiment. CrowdStrike is also around the 25 P/S mark but hasn't seen near the decline that Cloudflare has, mainly due to its high-quality cash flows.

With the stock for these three companies down about 48% (CrowdStrike), 69% (Okta), and 74% (Cloudflare), many investors have thrown these stocks out. But with secular tailwinds unlikely to be affected by consumer spending or a recession, these cybersecurity companies make great long-term investments. Use the current market weakness as a buying opportunity to get into these best-in-class companies at a steep discount.