A method for encrypting data, comprising: acquiring a first data unit included in a media frame to be encrypted, wherein the first data unit comprises a boundary portion and a content portion, the boundary portion comprises boundary information for identifying a starting boundary of the first data unit, and the content portion comprises content data of the first data unit; and encrypting the content data included in the content portion of the first data unit to acquire a second data unit, wherein a boundary portion of the second data unit comprises the boundary information, and a content portion of the second data unit comprises a data length of the content data and encrypted data acquired by encrypting the content data, characterized by packing the second data unit into a media packet of which a load field is a first load field or a third load field when the content data is parameter information of the media frame, and packing the second data unit into one or more media packets of which the load field is a second load field or a fourth load field when the content data is media data of the media frame; wherein the first load field comprises a type field and a payload field, the second load field comprises an indicator, a header and the payload field, the third load field comprises the header and the payload field, and the fourth payload field comprises the load header field, the header and the payload field; wherein packing the second data unit into one or more media packets of which the load field is the second load field comprises: generating a second media packet, wherein a header field of the second media packet comprises a timestamp of the media frame and a packet sequence number of the second media packet, and wherein in the second load field of the second media packet, the header is located between the indicator and the payload field, the boundary information comprises an identification code configured to indicate a type of the content data and comprising a first part of content and a second part of content, the indicator comprises the first part of content, the header comprises the second part of content and a first identification information for identifying the second media packet as a starting packet, the first identification information being located between the first part of content and the second part of content, and the payload field comprises the part of data intercepted from the starting position of the content portion of the second data unit. acquiring a first data unit included in a media frame to be encrypted, wherein the first data unit comprises a boundary portion and a content portion, the boundary portion comprises boundary information for identifying a starting boundary of the first data unit, and the content portion comprises content data of the first data unit; and encrypting the content data included in the content portion of the first data unit to acquire a second data unit, wherein a boundary portion of the second data unit comprises the boundary information, and a content portion of the second data unit comprises a data length of the content data and encrypted data acquired by encrypting the content data, characterized by packing the second data unit into a media packet of which a load field is a first load field or a third load field when the content data is parameter information of the media frame, and packing the second data unit into one or more media packets of which the load field is a second load field or a fourth load field when the content data is media data of the media frame; wherein the first load field comprises a type field and a payload field, the second load field comprises an indicator, a header and the payload field, the third load field comprises the header and the payload field, and the fourth payload field comprises the load header field, the header and the payload field; wherein packing the second data unit into one or more media packets of which the load field is the second load field comprises: generating a second media packet, wherein a header field of the second media packet comprises a timestamp of the media frame and a packet sequence number of the second media packet, and wherein in the second load field of the second media packet, the header is located between the indicator and the payload field, the boundary information comprises an identification code configured to indicate a type of the content data and comprising a first part of content and a second part of content, the indicator comprises the first part of content, the header comprises the second part of content and a first identification information for identifying the second media packet as a starting packet, the first identification information being located between the first part of content and the second part of content, and the payload field comprises the part of data intercepted from the starting position of the content portion of the second data unit.