Understanding retrieval of MD5 hash sums

Whenever KAV SDK scans an object through a monitor component or via a supported scanning function, you can request the SDK to provide a hash sum for the scanned object.

The following monitor components provided in KAV SDK are supported:

The following scanning functions that allow on-demand scanning are supported:

Working with hash sum functionality

Your typical scenario for working with MD5 using KAV SDK is as follows:

  1. You start scanning an object from your application or turn on a monitor

    Remember, by default KAV SDK uses callback function specified in kaveInitializeEx. This function is globally used in SDK to notify about the events raised by scanning functions and monitoring components.

    Alternatively, when scanning files using monitoring components, you may provide a separate callback function that will be used to handle events raised specifically by these components.

  2. KAV SDK detects a malicious object and calls your callback.
  3. Your application returns the CLBK_GET_OBJECT_HASH callback code.

    This code can be returned only when callback is called with the following codes in dwEvent:

    1. EVENT_PREDETECT

      This event is supported for all types of monitoring components (except for Proactive Defense Monitor (PDM)) and scanning functions.

    2. EVENT_SUSPECTED

      This event is supported only for PDM, a monitoring component that does not use EVENT_PREDETECT. Never return CLBK_GET_OBJECT_HASH when this event is returned by another type of monitoring component or a scanning function.

  4. KAV SDK returns hash sum for the requested object by calling your callback with EVENT_OBJECT_HASH notification code in dwEvent.
  5. You can specify if you want KAV SDK to skip or proceed with disinfection of object by returning:
    1. A confirmation return code

      Return CLBK_OK to further handle this object. Any but CLBK_CANCEL_OBJECT and CLBK_CANCEL_ALL return codes can be used to confirm disinfection of the found threat. For example, return of CLBK_GET_OBJECT_HASH on this step is interpreted as a confirmation code. Indeed, because KAV SDK already returned you the hash of the file, there is no need to resend it, and repetitive CLBK_GET_OBJECT_HASH are handled as CLBK_OK.

    2. A cancelation return code

      Return CLBK_CANCEL_ALL to cancel scanning object with dwObjectID and all its embedded objects, or CLBK_CANCEL_OBJECT to cancel processing only current object; embedded objects will be scanned next.

  6. Depending on the chosen return code, KAV SDK attempts to disinfect the object with the indicated dwObjectID or finishes scanning infected object.

What information is returned with callback on detection of threat

When KAV SDK calls your callback function to notify about the detection event, it returns the following data:

Requesting MD5 hash

To request an MD5 hash sum for the scanned dwObjectID, you must return the CLBK_GET_OBJECT_HASH callback code.

KAV SDK accepts this code only on the following stages:

When you do not need KAV SDK to provide you a hash sum for the scanned object, do not return CLBK_GET_OBJECT_HASH.

What information is returned with callback upon the generation of MD5

When KAV SDK calls your callback function to notify generated MD5 hash sum, it returns the following data:

How types of handled objects affect the resulting MD5 sum

Depending on the type of object where KAV SDK detects a threat, you may see the difference in how KAV SDK handles such objects when MD5 sum is requested. KAV SDK provides MD5 hash sums for specific types. Other types are supported for scanning and are not supported by MD5 hash sum functionality.

The following types of objects are supported:

All listed types of scanned objects are either parent objects or child objects. Parent objects may hold another objects within them, where child objects are nested within other objects, or, like the ADS, these objects originate from some other objects of similar kind.

There is a difference in how KAV SDK handles these objects design-wise. Whenever infected file is found within the scanned archive, KAV SDK returns MD5 hash sum for the unpacked version of infected file. However, if infection is defected in a packed file or container, hash sum is provided for packed file/container. If an alternate data stream is found infected, MD5 hash sum is provided for the main data stream, the stream from which stems the infected ADS.

See also

Callback function prototype

Callback function return values

Event notification codes

Expected return codes for callback function

KAV_HASH_TYPE

KAV_OBJECT_HASH

Page top