To register your own VerificationPlugin use the following interface as shown below:
Example: VerificationPluginImpl implementation of the VerificationPlugin service
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.List;
import org.osgi.service.component.annotations.Component;
import com.prosyst.mbs.services.onvif.ConnectionService;
import com.prosyst.mbs.services.onvif.OnvifDevice;
import com.prosyst.mbs.services.onvif.VerificationPlugin;
@Component(service = {VerificationPlugin.class})
public class VerificationPluginImpl implements VerificationPlugin {
private static final String VENDOR = "VendorName";
@Override
public void verify(OnvifDevice device, ConnectionService connectionService) throws IOException {
// get the device info like serial number, model, mac
String macAddress = device.getMacAddress();
String serialNumber = device.getSerialNumber();
// get the certificates of the device
List<Certificate> certs = connectionService.getCertificates();
// Do the process of verification and throw exception if device does not meet the requirements
throw new IOException("Serial number is not found in the HTTPS certificate.");
}
}