This application discloses a method, apparatus, and medium for implementing secure socket communication within the
operating system kernel, belonging to the field of computer systems and
network communication technology. This method registers a new secure socket type at the socket layer of the
operating system kernel and associates it with a customized set of operation functions. Applications only need to create sockets of this type and inject cryptographic parameters through
standard system calls to establish a connection, thereby obtaining transparent, end-to-end automatic encrypted communication capabilities. During transmission, data is encrypted in kernel mode by calling the native crypto subsystem API through a rewritten send function and an
authentication tag is attached. During reception, the rewritten receive function automatically performs decryption and integrity
verification. This scheme avoids reliance on large external security libraries, improves security and performance, and decentralizes
encryption / decryption,
resource management, and other processes to the kernel mode, providing upper-layer applications with easy-to-use, lightweight, high-performance, and highly secure kernel-level transparent
secure communication.