This invention discloses an interface
encryption method based on a request interception mechanism, relating to the field of
network security technology. The method includes
processing flows on both the
client and
server sides. On the
client side: After responding to a user operation and generating a business request carrying
original data, a preset request interceptor is invoked to intercept the request. The interceptor performs local
encryption processing on the
original data to obtain encrypted data, specifically including obtaining a
timestamp and
client identifier to generate a dynamic key, and using this key to encrypt the
original data. Subsequently, the original data in the business request is replaced with encrypted data, forming an encrypted request, which is then sent to the
server. On the
server side: After receiving the encrypted request, the encrypted data,
timestamp, and client identifier are parsed. The validity of the
timestamp and client identifier is first verified. After successful
verification, the dynamic
encryption key is restored using the same
algorithm, and then the original data is decrypted to execute the
business logic. This invention achieves unified and transparent interface encryption without intrusion into
business code by embedding an interceptor at the network request framework layer. Simultaneously, by utilizing dynamic keys and a two-way
verification mechanism, it significantly improves the security of
data transmission and the ability to prevent replay attacks, and facilitates centralized maintenance and policy upgrades.