4 Protocol Examples

Backing up a CA database

Figure 3: Backing up a CA database

A client determines that it is necessary to back up a CA database. To do so, the client needs to obtain the name of the CA to be backed up.

For this example, the CA name is "RootCA".

The following sequence of events needs to occur:

  1. The client pings the CA and verifies that the CA service is online. The client calls the method Ping with the following parameters.

     ICertAdminD::Ping(L"RootCA")
    

    The client verifies that the return value from this method is S_OK (0).

  2. The client sends a request to the CA to start a backup process. The client calls the BackupPrepare method with the following parameters.

     ICertAdminD::BackupPrepare( L"RootCA", 0, 0, NULL, 0 )
    

    The client verifies that the return value from this method is S_OK (0).

  3. The client retrieves the database file names. The client calls the BackupGetAttachmentInformation method with the following parameters.

     ICertAdminD::BackupGetAttachmentInformation
         (&pwszFileList,&cwList)
    
  4. The server returns the number of database and log files by setting the out cwList parameter (in this example, it is set to 1) and pwszFileList parameter (in this example, it is set to L"\\servername\e$\winnt\system32\certlog\rootca.edb").

  5. The client opens the specific database file returned in the preceding step. The client needs to learn the length of the file. The client calls the BackupOpenFile method with the following parameters.

     ICertAdminD::BackupOpenFile
         (L"\\servername\e$\winnt\system32\certlog\rootca.edb",&Length)
                   
    
  6. The server returns the length of the requested file in the Length parameter. In this example, the length is 123456.

  7. The client allocated the required buffer and reads the content of the DB file. The client calls the BackupReadFile method with the following parameters.

     ICertAdminD::BackupReadFile(pbData,123456,&Read)
    
  8. The server copies the content of the requested file to the pbData parameter and sets the length of the actual read operation into the Read parameter.

  9. The client closes the DB file. The client calls BackupCloseFile with no parameters. The client verifies that the return value from this method is S_OK (0).

  10. The client ends the backup operation by calling the BackupEnd method with no parameters.

Show: