3.5 Example 5: Encrypt a File
This example demonstrates encrypting a file as described in section 2.5.4.2.
Prerequisites
The Storage Services protocols meet all the preconditions, as described in section 2.4.
The EFS service, as described in [MS-EFSR], is enabled on both the client and server.
The communication channel between the Admin Client and the EFS service of the Storage Services protocols is established, as described in [MS-EFSR] section 2.1.
The file owner user identified the file that needs to be encrypted.
The file owner user has the required EFS certificates.
Initial System State
None.
Final System State
The file is encrypted.
Sequence of Events

Figure 12: Encrypting a file
The following steps describe this sequence:
The Admin Client contacts the EFS service to query information about the keys that are used to encrypt the file by using the EfsRpcFileKeyInfo method, as described in [MS-EFSR] section 3.1.4.2.12.
The EFS service returns zero on success.
The Admin Client contacts the EFS service to encrypt the file by using the EfsRpcEncryptFileSrv or EfsRpcEncryptFileExSrv method, as described in [MS-EFSR] sections 3.1.4.2.5 and 3.1.4.2.19.
The EFS service encrypts the requested file and returns zero on success.