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 Thumbprint, as a metadata entry, so every match returns the property name in Name and its value in Value.
Here are the steps to search for the values within the certificate document with GroupDocs.Signature:
Create new instance of Signature class and pass source document path as a constructor parameter.
Instantiate the CertificateSearchOptions object according to your requirements and specify search options.
This example shows how to make advanced search for text data within the certificate documents.
varloadOptions=newLoadOptions(){Password="1234567890"};using(varsignature=newSignature("certificate.pfx",loadOptions)){varoptions=newCertificateSearchOptions(){// check the serial numberText="AAD0D15C628A",// match by substringMatchType=TextMatchType.Contains,};// search for certificate datavarresult=signature.Search<MetadataSignature>(options);if(result.Count>0){Console.WriteLine("\nCertificate contains following search results");foreach(MetadataSignaturetempinresult){Console.WriteLine($"\t\t-{temp.Name} - {temp.Value}");}}else{Helper.WriteError("\nCertificate failed search process.");}}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: