If you looked at the stock charts, you'd think 2022 was a bad year for the cybersecurity industry. But in fact, the bear market is masking a surge in the expansion of operations that began when the pandemic fired off a warning shot to organizations around the globe: Protect your digital assets ... or else.

Cybersecurity has always been important, but with every sector of the economy rapidly adopting cloud computing, effective security software is now an absolute necessity. 

As measured by revenue, two companies sit atop the cybersecurity industry: Palo Alto Networks (PANW -0.99%) and Fortinet (FTNT 0.42%). Are they smart buys for 2023? 

Fast-and-steady growth, plenty of profits

Both Palo Alto Networks and Fortinet harken back to the days before cloud computing was a thing. Back then, protecting an IT system was all about throwing up a firewall (a device that manages traffic going into and out of a communications system) for an office building. There's still a need for such devices today, but the cloud has changed the game. 

For its part, Palo Alto Networks has remained relevant by acquiring a slew of next-gen cloud security upstarts. The strategy, spearheaded by CEO Nikesh Arora, has worked wonders. In its fiscal 2022, which ended July 31, the company's revenue and adjusted earnings per share (EPS) increased by 29% and 23%, respectively. It got off to a hot start in its fiscal 2023 as well. In its first quarter (which ended Oct. 31), revenue and adjusted EPS grew 25% and 51% year over year, respectively.

Fortinet took a different path. It continued to invest in its leading firewall technology, putting it to use as various networking technologies (data centers, 5G mobile, etc.) need security embedded in them. It's been following a type of land-and-expand strategy. Once a Fortinet security device is installed, the customer then turns on the recurring software security services that Fortinet has been developing mostly in-house. In the third quarter, its revenue and adjusted EPS increased 33% and 65%, respectively, year over year.

Can Palo Alto Networks and Fortinet beat the market?

Despite a resurgence in growth this past year, shares of Palo Alto Networks and Fortinet failed to beat the overall market in 2022 -- though both are outpacing the especially beaten-down Nasdaq Composite index, which is down by 34% year to date. It's a bear market out there, and high-growth but also richly valued stocks have been punished.  

Headed into 2023 and beyond, though, the top dogs in cybersecurity have all the makings of long-term market-beating investments. Driven by secular growth trends from the cloud, the security market will likely remain a fast-growing one for many years. Palo Alto Networks and Fortinet both expect to continue growing their sales at rates north of 20% per year, generating robust amounts of free cash flow along the way. Neither stock pays a dividend, but both companies use some of that free cash flow for stock buybacks, which boost earnings for shareholders on a per-share basis over time.

Over the last reported 12-month stretch, Palo Alto Networks repurchased $915 million worth of stock, while Fortinet repurchased a whopping $2.54 billion. If both companies can continue growing profitably, there's plenty more where that came from.  

Their balance sheets were also in good condition. At the end of October, Palo Alto Networks had $3.8 billion in cash and short-term investments on its books, offset by convertible debt of $3.74 billion. Fortinet had $1.7 billion in cash and short-term investments and $990 million in debt.

With just a couple of weeks left in 2022, Palo Alto Networks and Fortinet shares trade for 19 times and 36 times their trailing 12-month free cash flows, respectively. These top cybersecurity stocks look like smart buys for the long haul in 2023.