@Override
    public void receivedAnswer(IQ packet) {
        String packetId = packet.getID();

        if (isValid(packet)) {
            // The packet was validated, so it can be added to the Entity
            // Capabilities cache map.

            // Add the resolved identities and features to the entity 
            // EntityCapabilitiesManager.capabilities object and add it 
            // to the cache map...
            EntityCapabilities caps = verAttributes.get(packetId);

            // Store identities.
            List<String> identities = getIdentitiesFrom(packet);
            for (String identity : identities) {
                caps.addIdentity(identity);
            }

            // Store features.
            List<String> features = getFeaturesFrom(packet);
            for (String feature : features) {
                caps.addFeature(feature);
            }

            Log.trace( "Received response to querying 'ver'. Caps now recognized. Received response from: {}", packet.getFrom() );
            registerCapabilities( packet.getFrom(), caps );
        }

        // Remove cached 'ver' attribute.
        verAttributes.remove(packetId);
    }
Generates a 'ver' hash attribute used in validation to help prevent
poisoning of entity capabilities information.

@see #isValid(IQ)

The value of the 'ver' attribute is generated according to the method
outlined in XEP-0115.

@param packet IQ reply to the entity cap request.
@param algorithm The hashing algorithm to use (e.g. SHA-1)
@return the generated 'ver' hash
xmppserver/src/main/java/org/jivesoftware/openfire/entitycaps/EntityCapabilitiesManager.java