The Pakistan Aeronautical Complex at Kamra is the country's major air force maintenance and research hub.
Some foreign military experts have mentioned it as a possible place to keep planes that can carry nuclear warheads, but the army, which does not reveal where its nuclear-related facilities are, strongly denies that the facility is tied to the program in any way.
A lone suicide bomber on a bicycle blew himself up at a checkpoint on a road leading to the complex, about 30 miles (50 kilometers) from the capital, Islamabad. Police officer Akbar Abbas blamed the Taliban for the attack.
The seven dead included two troops. Some 13 people were wounded.
Hours later, a blast struck the bus, which was traveling in the Mohmand tribal region. Four women and three children were among the 17 killed, said Zabit Khan, a local government official, who said the exact cause of the blast was still not certain.
"It appears to be a remote-controlled bomb, and militants might have hit the bus mistakenly," Khan told The Associated Press.
Mohmand, like other parts of Pakistan's tribal belt, has been a magnet for Taliban militants. The military has carried out operations there in the past aimed at clearing out insurgents but trouble still flares.
Also Friday, a car bomb exploded in the parking lot of a recreational facility in Peshawar, the main city in the northwest. Fifteen people were wounded. The facility includes a restaurant, a swimming pool, a health club and a marriage hall.
"It is part of the violence we are seeing across Pakistan these days," said Mian Iftikhar Hussain, the region's information minister.
There have been at least nine major militant attacks this month, most against police or army targets.
Some have been explosions, while others have involved teams of gunmen staging raids. In one of the most brazen attacks, gunmen attacked the army headquarters close to the capital and held hostages inside the complex for 22 hours.
Pakistan is under intense pressure to eliminate Islamist militant groups sheltering in its northwest that also attack U.S. and NATO troops in Afghanistan. The military has battled them in various districts, losing hundreds of soldiers, but questions remain about its overall strategic commitment to the fight.
It began its current offensive in the South Waziristan tribal region seven days ago.
A military statement Friday reported two more soldiers were killed, bringing the army's death toll to 20, and that 13 more militants were slain, bringing their death toll to 142. Reporters are blocked from entering the region, meaning verifying information is all but impossible.
The army has previously moved into South Waziristan three times since 2004. Each time it has suffered high casualties and signed peace deals that left insurgents with effective control of the region. Western officials say al-Qaida now uses it and neighboring North Waziristan as an operations and training base.
Associated Press writers Ashraf Khan in Islamabad, Riaz Khan in Peshawar, Habib Khan in Khar and Zarar Khan and Ishtiaq Mahsud in Dera Ismail Khan contributed to this report.