Once it was clear the code had been stolen, the National Security Agency rushed to contain the damage, asking Microsoft to build a “patch” in its operating systems to prevent the attacks. But the agency has never talked about the group that stole the computer code, called the Shadow Brokers, which many officials believe is operating on behalf of the Russian government. But Mr. Bossert and his deputy, Rob Joyce, who formerly ran the Tailored Access Operations, have argued that it is the perpetrator of the attacks, not the United States government, that must take all of the responsibility for the damage it has wreaked.

“The consequences and repercussions of WannaCry were beyond economic,” Mr. Bossert wrote. “The malicious software hit computers in the U.K.’s health care sector particularly hard, compromising systems that perform critical work. These disruptions put lives at risk.”

The assertion by the White House came only hours after Mr. Trump published his new national security strategy, which calls for pushing back on states that sponsor cyberactivity. And even some alumni of the Obama administration now agree that they often underreacted to a range of digital threats, including Iran’s 2012 attacks on American banks, the hacking at Sony and the effort by Russia to intervene in the election. Until now, North Korea’s cyberstrikes have prompted almost no punishment.

Mr. Bossert seems determined to change that, and he wrote about elements of a new digital strategy that suggests that the Trump administration will be more aggressive in alerting manufacturers to flaws found in their software. But he has been vague about what kind of actions might be taken against those who initiate cyberattacks.

Robert Hannigan, the former director of Britain’s Government Communications Headquarters, said last month that in the realm of digital breaches, North Korea had benefited from being underestimated.

“Because they are such a mix of the weird and absurd and medieval and highly sophisticated, people didn’t take it seriously,” he said. “How can such an isolated, backward country have this capability? Well, how can such an isolated backward country have this nuclear ability?”