The government is about to invest $3.2 million to make sure you are who you say you are before you board an airplane.

In an era when boarding passes often are printed at home and fraudulent identification cards have gone so high-tech they can elude routine inspection, the Transportation Security Administration has opted to buy equipment that will ensure both are genuine.

The TSA has been quietly testing scanning devices since July and plans to buy 30 scanner systems from three different vendors for deployment at airports early next year. The airports haven’t been chosen yet, the TSA said, but the scanners will be positioned at the head of the security checkpoint lines.

“It will scan your ID to make sure it’s okay and then it will scan your boarding pass and compare the information,” said the TSA’s Mike McCarthy.

He said the devices, known as Credential Authentication Technology-Boarding Pass Scanning Systems (CAT-BPSS), would replace the current system where a uniformed TSA employee reviews the documents and often uses a special flashlight to check the security features on driver’s licenses and passports.

Whether printed at home or issued at the airline check-in counter, most boarding passes have bar codes that contain the passenger’s information. Though identification documents are checked by airline personnel at the counter, very few airlines have scanners that verify their authenticity.

In the past decade, high-quality fake driver’s licenses that contain realistic holograms and other coding have been available, some of them being manufactured in China. Some are said to carry bar codes that also elude detection.

One method that scanner companies use to detect these fraudulent IDs relies on the fact that there normally are imperfections in the genuine driver’s licenses issued by state agencies. Once they feed those quirks into the scanner system, a too-perfect ID card reveals itself as a fraud.

The TSA also announced Thursday that 29 mid-sized airports will begin to use the new generation of walk-through security scanners that became controversial last year, drawing complaints that they were unnecessarily revealing of a person’s body. The TSA later revised its software so that the images were limited to a gingerbread-man outline that showed the location of any suspicious items.

The 29 airports will receive a type called millimeter-wave advanced imaging technology (AIT) machines. They already are in use at the three major airports in the Washington region.