Advanced search certificate documents

GroupDocs.Signature provides CertificateSearchOptions class to specify different options to search text data within the certificate documents. Please be aware that the search result will always be a list of MetadataSignature objects. GroupDocs.Signature reads each certificate property, such as SerialNumber, Issuer, Subject or Expiration, as a metadata entry, so every match returns the property name in getName() and its value in getValue(). The text is matched against the string form of each value; the serial number is read as a decimal number, not as a hexadecimal string.

Here are the steps to search for the values within the certificate document with GroupDocs.Signature:

This example shows how to make advanced search for text data within the certificate documents.

LoadOptions loadOptions = new LoadOptions();
loadOptions.setPassword("1234567890");

Signature signature = new Signature("certificate.pfx", loadOptions);
try
{
    CertificateSearchOptions options = new CertificateSearchOptions();
    // check the serial number (Java reads it as a decimal number)
    options.setText("12308567976323978183");
    // match by substring
    options.setMatchType(TextMatchType.Contains);

    // search for certificate data
    List<MetadataSignature> result = signature.search(MetadataSignature.class, options);
    if (result.size() > 0)
    {
        System.out.println("\nCertificate contains following search results");
        for (MetadataSignature temp : result)
        {
            System.out.println("\t\t-" + temp.getName() + " - " + temp.getValue());
        }
    }
    else
    {
        System.out.println("\nCertificate failed search process.");
    }
}
finally
{
    signature.dispose();
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured Java library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.