A method for obtaining key management server, KMS, ID, the method. comprising: in the process of a user equipment registering an IP multimedia subsystem, IMS, storing (209-216, 309-317, 409-416) the KMS ID corresponding to the user equipment in a preset IMS core network network element; and when a lawful intercepting device monitors a session initiated by the user equipment, intercepting a session request signaling sent by the user equipment, and obtaining an identification information of the user equipment from the session request signaling, and searching the KMS ID corresponding to the user equipment from the preset IMS core network network element according to the identification information of the user equipment for obtaining key material from a KMS corresponding to the KMS ID; wherein the step of storing the KMS ID corresponding to the user equipment in the preset IMS core network network element comprises: when the user equipment pre-configures the KMS ID, sending (209-212, 409-412) the pre-configured KMS ID to the preset IMS core network network element by a registration message; and the preset IMS core network network element receiving the registration message, and obtaining the KMS ID from the registration message and storing the KMS ID; or, when the user equipment registers to an IMS core network, the preset IMS core network network element allocating to the user equipment a KMS corresponding to the user equipment, and storing the KMS ID of the allocated KMS in the preset IMS core network network element. in the process of a user equipment registering an IP multimedia subsystem, IMS, storing (209-216, 309-317, 409-416) the KMS ID corresponding to the user equipment in a preset IMS core network network element; and when a lawful intercepting device monitors a session initiated by the user equipment, intercepting a session request signaling sent by the user equipment, and obtaining an identification information of the user equipment from the session request signaling, and searching the KMS ID corresponding to the user equipment from the preset IMS core network network element according to the identification information of the user equipment for obtaining key material from a KMS corresponding to the KMS ID; wherein the step of storing the KMS ID corresponding to the user equipment in the preset IMS core network network element comprises: when the user equipment pre-configures the KMS ID, sending (209-212, 409-412) the pre-configured KMS ID to the preset IMS core network network element by a registration message; and the preset IMS core network network element receiving the registration message, and obtaining the KMS ID from the registration message and storing the KMS ID; or, when the user equipment registers to an IMS core network, the preset IMS core network network element allocating to the user equipment a KMS corresponding to the user equipment, and storing the KMS ID of the allocated KMS in the preset IMS core network network element. when the user equipment pre-configures the KMS ID, sending (209-212, 409-412) the pre-configured KMS ID to the preset IMS core network network element by a registration message; and the preset IMS core network network element receiving the registration message, and obtaining the KMS ID from the registration message and storing the KMS ID; or, when the user equipment registers to an IMS core network, the preset IMS core network network element allocating to the user equipment a KMS corresponding to the user equipment, and storing the KMS ID of the allocated KMS in the preset IMS core network network element.