In public-key cryptosystems（PKI），whether it is RSA cryptography or elliptic curve cryptography （ECC），modular inversion operations are very critical operations. The premise of modular inversion operations is that the greatest common divisor（GCD）of the two numbers is 1，otherwise the result is meaningless. Based on the existing binary modular inversion algorithms，an algorithm that can simultaneously find the GCD and perform modu? lar inversion operations is proposed，and the algorithm is optimized and implemented in hardware using VERILOG HDL language. Through functional simulation and FPGA verification，the results show that this design can correctly perform the modular inversion operation of large number from 32 to 1 024 bits. The design is applied to a PKI module of an automotive security chip，using UMC 55 nm process for tape-out，and the chip area is 10 mm2. When the work? ing voltage is 3.3 V and the clock frequency is 200 MHz，the power consumption is about 30.2 mW.