摘要 |
The present invention provides an encryption and decryption method and device. In the method, a first optical transport network (OTN) transport device encrypts, according to an initial vector (IV), a key, and an encryption algorithm that are preset, data received by the first OTN transport device, and sends the IV and the encrypted data to a second OTN transport device; and the second OTN transport device receives a value of a high-order counter in the IV and the encrypted data that are sent by the first OTN transport device, where the encrypted data is data encrypted by using the IV, the preset key, and the encryption algorithm, and decrypts the encrypted data according to the preset key, the IV, and a decryption algorithm corresponding to the encryption algorithm. |
主权项 |
1. A decryption method, comprising:
receiving, by a second optical transport network (OTN) transport device, a value of a high-order counter in an initial vector (IV) and encrypted data that are sent by a first OTN transport device, wherein the encrypted data is data encrypted by using the IV, a preset key, and an encryption algorithm; and decrypting the encrypted data according to the preset key, the IV, and a decryption algorithm corresponding to the encryption algorithm, wherein the IV comprises the value of the high-order counter and a value of a low-order counter, and wherein the low-order counter is a counter predetermined by the first OTN transport device and the second OTN transport device, wherein receiving, by the second OTN transport device, the value of the high-order counter in the IV and the encrypted data that are sent by the first OTN transport device, wherein the encrypted data is the data encrypted by using the IV, the preset key, and the encryption algorithm comprises receiving, by the second OTN transport device, the value of the high-order counter sent by the first OTN transport device by using a preset overhead in an optical channel data unit (ODU) frame or an optical channel transport unit (OTU) frame, and wherein before decrypting the encrypted data according to the preset key, the IV, and the decryption algorithm corresponding to the encryption algorithm, the method further comprises:
detecting whether the values of the high-order counter sent by the first OTN transport device are consecutive for multiple times when the second OTN transport device detects that the values of the high-order counter are non-consecutive, wherein the multiple times are at least one time; andchanging, by the second OTN transport device, values of a local high-order counter to the values of the high-order counter sent by the first OTN transport device when the values of the high-order counter sent by the first OTN transport device are consecutive for multiple times. |