Struct ipworksllm::C2PAVerifier
Properties Methods Events Config Settings Errors
Extracts and validates the C2PA Manifests embedded in an asset.
Syntax
ipworksllm::C2PAVerifier
Remarks
The C2PAVerifier struct reads the Content Credentials embedded in an asset and reports what can be established about them: whether the signature is intact, whether the signer is trusted, and whether the asset bytes still match what was signed.
Supported Formats
JPEG, PNG and PDF are supported. The format is detected from the asset itself, and an asset in any other format is refused rather than reported as carrying no provenance, since those are different answers.
The PDF reader locates the manifest by its file specification's AFRelationship, so it reads manifests written by any conforming tool, not only those this product produced.
Validating an Asset
Set input_file to the asset and call verify. Every manifest found is then added to the manifests properties, and one entry per check performed is added to validation_results.
C2PAVerifier verifier = new C2PAVerifier();
verifier.InputFile = "photo-signed.jpg";
verifier.Verify();
foreach (C2PAValidationResult result in verifier.ValidationResults)
Console.WriteLine(result.Severity + " " + result.Code + ": " + result.Explanation);
Reading the Results
Validation is not a single boolean. The C2PA specification defines a status code for each individual check, and the struct reports them verbatim so an application can decide how much weight to give each one. A signature that verifies but whose signer is not on a trust list is a different situation from one whose content binding fails.
Each entry in validation_results carries a Severity of success, informational, or failure. Codes such as claimSignature.validated and assertion.dataHash.match are successes; assertion.dataHash.mismatch means the asset was altered after signing; signingCredential.untrusted means the signature is intact but the signer does not chain to any configured trust anchor.
The on_validation_status event fires once for each result as it is produced, which is convenient when validation should be reported incrementally rather than inspected afterwards.
The Provenance Chain
An asset may carry more than one manifest: the active manifest describes the most recent edit, and earlier manifests describe the ingredients it was built from. All of them appear in manifests, with active_manifest_index identifying the active one.
verifier.Verify();
C2PAManifest active = verifier.Manifests[verifier.ActiveManifestIndex];
Console.WriteLine("Produced by " + active.ClaimGenerator + ", signed by " + active.SignerSubject);
Trust Anchors
By default the struct validates signing certificates against the built-in C2PA trust list. Additional anchors are supplied through the trusted_certs properties, and are used in addition to the built-in list rather than instead of it, as the C2PA specification prescribes. Setting use_c2_pa_trust_list to False restricts validation to the supplied anchors alone, which is the correct configuration for a private PKI.
Setting check_revocation to True additionally performs online revocation checking. Revocation information stapled into the manifest by the signer is always used when present, whether or not online checking is enabled.
Object Lifetime
The new() method returns a mutable reference to a struct instance. The object itself is kept in the global list maintained by IPWorksLLM. Due to this, the C2PAVerifier struct cannot be disposed of automatically. Please, call the dispose(&self) method of C2PAVerifier when you have finished using the instance.
Property List
The following is the full list of the properties of the struct with short descriptions. Click on the links for further details.
| active_manifest_index | The index of the active manifest in the Manifests collection. |
| check_revocation | Whether online revocation checking is performed. |
| ingredient_count | The number of records in the Ingredient arrays. |
| ingredient_format | The media type of the ingredient asset. |
| ingredient_instance_id | The instance identifier of the ingredient asset. |
| ingredient_manifest_label | The label of the ingredient's own C2PA Manifest. |
| ingredient_relationship | How the ingredient relates to the asset. |
| ingredient_title | A human-readable name for the ingredient. |
| input_data | The asset to process, held in memory. |
| input_file | The asset to process. |
| manifest_count | The number of records in the Manifest arrays. |
| manifest_claim_generator | The tool that produced this manifest. |
| manifest_is_active | Whether this is the active manifest. |
| manifest_label | The manifest's identifier. |
| manifest_signer_subject | The subject of the certificate that signed the claim. |
| manifest_signing_time | When the claim was signed. |
| trusted_cert_count | The number of records in the TrustedCert arrays. |
| trusted_cert_effective_date | The date on which this certificate becomes valid. |
| trusted_cert_expiration_date | The date on which the certificate expires. |
| trusted_cert_extended_key_usage | A comma-delimited list of extended key usage identifiers. |
| trusted_cert_fingerprint | The hex-encoded, 16-byte MD5 fingerprint of the certificate. |
| trusted_cert_fingerprint_sha1 | The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. |
| trusted_cert_fingerprint_sha256 | The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. |
| trusted_cert_issuer | The issuer of the certificate. |
| trusted_cert_private_key | The private key of the certificate (if available). |
| trusted_cert_private_key_available | Whether a PrivateKey is available for the selected certificate. |
| trusted_cert_private_key_container | The name of the PrivateKey container for the certificate (if available). |
| trusted_cert_public_key | The public key of the certificate. |
| trusted_cert_public_key_algorithm | The textual description of the certificate's public key algorithm. |
| trusted_cert_public_key_length | The length of the certificate's public key (in bits). |
| trusted_cert_serial_number | The serial number of the certificate encoded as a string. |
| trusted_cert_signature_algorithm | The text description of the certificate's signature algorithm. |
| trusted_cert_store | The name of the certificate store for the client certificate. |
| trusted_cert_store_password | If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store. |
| trusted_cert_store_type | The type of certificate store for this certificate. |
| trusted_cert_subject_alt_names | Comma-separated lists of alternative subject names for the certificate. |
| trusted_cert_thumbprint_md5 | The MD5 hash of the certificate. |
| trusted_cert_thumbprint_sha1 | The SHA-1 hash of the certificate. |
| trusted_cert_thumbprint_sha256 | The SHA-256 hash of the certificate. |
| trusted_cert_usage | The text description of UsageFlags . |
| trusted_cert_usage_flags | The flags that show intended use for the certificate. |
| trusted_cert_version | The certificate's version number. |
| trusted_cert_subject | The subject of the certificate used for client authentication. |
| trusted_cert_encoded | The certificate (PEM/Base64 encoded). |
| use_c2_pa_trust_list | Whether the built-in C2PA trust list is used. |
| validation_result_count | The number of records in the ValidationResult arrays. |
| validation_result_code | The C2PA status code. |
| validation_result_explanation | A human-readable description of the result. |
| validation_result_manifest_label | The manifest the result applies to. |
| validation_result_severity | How serious the result is. |
Method List
The following is the full list of the methods of the struct with short descriptions. Click on the links for further details.
| config | Sets or retrieves a configuration setting. |
| reset | This method will reset the struct. |
| verify | Extracts and validates the C2PA Manifests in the asset. |
Event List
The following is the full list of the events fired by the struct with short descriptions. Click on the links for further details.
| on_error | Fired when information is available about errors during data delivery. |
| on_log | This event fires once for each log message. |
| on_manifest_found | Fires once for each C2PA Manifest found in the asset. |
| on_validation_status | Fires once for each validation status code produced. |
Config Settings
The following is a list of config settings for the struct with short descriptions. Click on the links for further details.
| AcceptedEKUs | The extended key usages accepted from a claim signer. |
| LogLevel | The level of detail logged through the Log event. |
| TrustListDate | The date the built-in C2PA trust list was captured. |
| TrustListVersion | The version of the built-in C2PA trust list. |
| ValidateIngredients | Whether ingredient manifests are validated as well as the active one. |
| BuildInfo | Information about the product's build. |
| CodePage | The system code page used for Unicode to Multibyte translations. |
| LicenseInfo | Information about the current license. |
| MaskSensitiveData | Whether sensitive data is masked in log messages. |
| UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
active_manifest_index property (C2PAVerifier Struct)
The index of the active manifest in the Manifests collection.
Syntax
fn active_manifest_index(&self) -> Result<i32, IPWorksLLMError>
Default Value
-1
Remarks
This property identifies which item in manifests is the active manifest, the one describing how the asset reached its current state. The C2PA specification fixes the active manifest as the last one in the manifest store.
The value is -1 when no manifest was found.
This property is read-only.
Data Type
i32
check_revocation property (C2PAVerifier Struct)
Whether online revocation checking is performed.
Syntax
fn check_revocation(&self) -> Result<bool, IPWorksLLMError>
fn set_check_revocation(&self, value : bool) -> Option<IPWorksLLMError>
Default Value
false
Remarks
This property controls whether the struct contacts OCSP responders or downloads CRLs to determine whether the signing certificate has been revoked.
Revocation information stapled into the manifest by the signer is always used when present, whether or not this property is set. Setting it to True additionally performs an online check, which requires network access and makes verification slower.
When revocation cannot be determined, verification does not fail; an informational result such as signingCredential.ocsp.inaccessible or signingCredential.ocsp.skipped is reported so the application can decide what that is worth.
The default value is False.
Data Type
bool
ingredient_count property (C2PAVerifier Struct)
The number of records in the Ingredient arrays.
Syntax
fn ingredient_count(&self) -> Result<i32, IPWorksLLMError>
fn set_ingredient_count(&self, value : i32) -> Option<IPWorksLLMError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- ingredient_format
- ingredient_instance_id
- ingredient_manifest_label
- ingredient_relationship
- ingredient_title
Data Type
i32
ingredient_format property (C2PAVerifier Struct)
The media type of the ingredient asset.
Syntax
fn ingredient_format(&self, IngredientIndex : i32) -> Result<String, IPWorksLLMError>
fn set_ingredient_format(&self, IngredientIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_ingredient_format_ref(&self, IngredientIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This field holds the media type of the asset that went into this one, for example image/jpeg, image/png or application/pdf. The component fills it in from the source asset when the ingredient is added.
The IngredientIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ingredient_count property.
Data Type
String
ingredient_instance_id property (C2PAVerifier Struct)
The instance identifier of the ingredient asset.
Syntax
fn ingredient_instance_id(&self, IngredientIndex : i32) -> Result<String, IPWorksLLMError>
fn set_ingredient_instance_id(&self, IngredientIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_ingredient_instance_id_ref(&self, IngredientIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This field holds the identifier of the exact version of the asset that went into this one, normally an XMP instance identifier such as xmp:iid:....
When the ingredient carried a C2PA Manifest of its own, the component fills this in from that Manifest's claim, so the reference names the precise version that was used rather than the document in general.
Version 2 of the ingredient assertion also carried a document identifier. Version 3, which this component writes, removed it, so there is no corresponding field.
The IngredientIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ingredient_count property.
Data Type
String
ingredient_manifest_label property (C2PAVerifier Struct)
The label of the ingredient's own C2PA Manifest.
Syntax
fn ingredient_manifest_label(&self, IngredientIndex : i32) -> Result<String, IPWorksLLMError>
fn set_ingredient_manifest_label(&self, IngredientIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_ingredient_manifest_label_ref(&self, IngredientIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This field identifies the manifest that describes the ingredient, when the ingredient carried one. It is the urn:c2pa label of that manifest within the same manifest store.
An empty value means the ingredient arrived without provenance data of its own.
The IngredientIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ingredient_count property.
Data Type
String
ingredient_relationship property (C2PAVerifier Struct)
How the ingredient relates to the asset.
Syntax
fn ingredient_relationship(&self, IngredientIndex : i32) -> Result<String, IPWorksLLMError>
fn set_ingredient_relationship(&self, IngredientIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_ingredient_relationship_ref(&self, IngredientIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
"componentOf"
Remarks
This field describes the ingredient's role. The C2PA specification defines the following values:
| parentOf | The asset is a derivative of this ingredient. There is at most one parent. |
| componentOf | The ingredient was placed into the asset alongside other content. |
| inputTo | The ingredient was consumed as input, for example as a prompt or a training input, without appearing in the result. |
The default value is componentOf.
The IngredientIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ingredient_count property.
Data Type
String
ingredient_title property (C2PAVerifier Struct)
A human-readable name for the ingredient.
Syntax
fn ingredient_title(&self, IngredientIndex : i32) -> Result<String, IPWorksLLMError>
fn set_ingredient_title(&self, IngredientIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_ingredient_title_ref(&self, IngredientIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This field holds a title for the ingredient asset, typically its filename, so a consumer can present the provenance chain in terms a person recognises.
The IngredientIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ingredient_count property.
Data Type
String
input_data property (C2PAVerifier Struct)
The asset to process, held in memory.
Syntax
fn input_data(&self) -> Result<Vec<u8>, IPWorksLLMError>
fn set_input_data(&self, value : Vec<u8>) -> Option<IPWorksLLMError> fn set_input_data_ref(&self, value : &[u8]) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This property specifies the asset to be processed as a byte array, for applications that do not work with files on disk.
When both input_file and this property are set, input_file takes precedence.
Data Type
Vec<u8>
input_file property (C2PAVerifier Struct)
The asset to process.
Syntax
fn input_file(&self) -> Result<String, IPWorksLLMError>
fn set_input_file(&self, value : &str) -> Option<IPWorksLLMError> fn set_input_file_ref(&self, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This property specifies the asset to be processed. Set it to the full or relative path of the file.
When both this property and input_data are set, this property takes precedence.
Data Type
String
manifest_count property (C2PAVerifier Struct)
The number of records in the Manifest arrays.
Syntax
fn manifest_count(&self) -> Result<i32, IPWorksLLMError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- manifest_claim_generator
- manifest_is_active
- manifest_label
- manifest_signer_subject
- manifest_signing_time
This property is read-only.
Data Type
i32
manifest_claim_generator property (C2PAVerifier Struct)
The tool that produced this manifest.
Syntax
fn manifest_claim_generator(&self, ManifestIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field names the application that created the claim, as recorded by its signer.
It is a claim, not a verified fact: it says what the signer wrote down. What the signature establishes is who wrote it, which is manifest_signer_subject.
The ManifestIndex parameter specifies the index of the item in the array. The size of the array is controlled by the manifest_count property.
This property is read-only.
Data Type
String
manifest_is_active property (C2PAVerifier Struct)
Whether this is the active manifest.
Syntax
fn manifest_is_active(&self, ManifestIndex : i32) -> Result<bool, IPWorksLLMError>
Default Value
false
Remarks
This field is True for the manifest that describes how the asset reached its current state, and False for the manifests that came with its ingredients.
The C2PA specification fixes the active manifest as the last one in the manifest store.
The ManifestIndex parameter specifies the index of the item in the array. The size of the array is controlled by the manifest_count property.
This property is read-only.
Data Type
bool
manifest_label property (C2PAVerifier Struct)
The manifest's identifier.
Syntax
fn manifest_label(&self, ManifestIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field holds the manifest's label, a urn:c2pa value that uniquely identifies it within the manifest store. Ingredients refer to their manifests by this value.
The ManifestIndex parameter specifies the index of the item in the array. The size of the array is controlled by the manifest_count property.
This property is read-only.
Data Type
String
manifest_signer_subject property (C2PAVerifier Struct)
The subject of the certificate that signed the claim.
Syntax
fn manifest_signer_subject(&self, ManifestIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field holds the distinguished name of the signing certificate's subject.
This is the identity the signature actually establishes, provided the certificate chains to a trust anchor. Check the validation results for signingCredential.trusted before treating it as meaningful: an untrusted certificate can carry any subject its issuer chose to put in it.
The ManifestIndex parameter specifies the index of the item in the array. The size of the array is controlled by the manifest_count property.
This property is read-only.
Data Type
String
manifest_signing_time property (C2PAVerifier Struct)
When the claim was signed.
Syntax
fn manifest_signing_time(&self, ManifestIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field holds the signing time as an RFC 3339 date and time.
When the manifest carries an RFC 3161 time-stamp, this is the time attested by the Time Stamping Authority, and it is what allows the signature to remain verifiable after the signing certificate expires. Without a time-stamp the value is the signer's own claimed time, which carries no more weight than the rest of the claim.
The ManifestIndex parameter specifies the index of the item in the array. The size of the array is controlled by the manifest_count property.
This property is read-only.
Data Type
String
trusted_cert_count property (C2PAVerifier Struct)
The number of records in the TrustedCert arrays.
Syntax
fn trusted_cert_count(&self) -> Result<i32, IPWorksLLMError>
fn set_trusted_cert_count(&self, value : i32) -> Option<IPWorksLLMError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- trusted_cert_effective_date
- trusted_cert_encoded
- trusted_cert_expiration_date
- trusted_cert_extended_key_usage
- trusted_cert_fingerprint
- trusted_cert_fingerprint_sha1
- trusted_cert_fingerprint_sha256
- trusted_cert_issuer
- trusted_cert_private_key
- trusted_cert_private_key_available
- trusted_cert_private_key_container
- trusted_cert_public_key
- trusted_cert_public_key_algorithm
- trusted_cert_public_key_length
- trusted_cert_serial_number
- trusted_cert_signature_algorithm
- trusted_cert_store
- trusted_cert_store_password
- trusted_cert_store_type
- trusted_cert_subject
- trusted_cert_subject_alt_names
- trusted_cert_thumbprint_md5
- trusted_cert_thumbprint_sha1
- trusted_cert_thumbprint_sha256
- trusted_cert_usage
- trusted_cert_usage_flags
- trusted_cert_version
Data Type
i32
trusted_cert_effective_date property (C2PAVerifier Struct)
The date on which this certificate becomes valid.
Syntax
fn trusted_cert_effective_date(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:
23-Jan-2000 15:00:00.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_expiration_date property (C2PAVerifier Struct)
The date on which the certificate expires.
Syntax
fn trusted_cert_expiration_date(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:
23-Jan-2001 15:00:00.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_extended_key_usage property (C2PAVerifier Struct)
A comma-delimited list of extended key usage identifiers.
Syntax
fn trusted_cert_extended_key_usage(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_fingerprint property (C2PAVerifier Struct)
The hex-encoded, 16-byte MD5 fingerprint of the certificate.
Syntax
fn trusted_cert_fingerprint(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_fingerprint_sha1 property (C2PAVerifier Struct)
The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.
Syntax
fn trusted_cert_fingerprint_sha1(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: 30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_fingerprint_sha256 property (C2PAVerifier Struct)
The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.
Syntax
fn trusted_cert_fingerprint_sha256(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: 6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_issuer property (C2PAVerifier Struct)
The issuer of the certificate.
Syntax
fn trusted_cert_issuer(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The issuer of the certificate. This property contains a string representation of the name of the issuing authority for the certificate.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_private_key property (C2PAVerifier Struct)
The private key of the certificate (if available).
Syntax
fn trusted_cert_private_key(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.
NOTE: The trusted_cert_private_key may be available but not exportable. In this case, trusted_cert_private_key returns an empty string.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_private_key_available property (C2PAVerifier Struct)
Whether a PrivateKey is available for the selected certificate.
Syntax
fn trusted_cert_private_key_available(&self, TrustedCertIndex : i32) -> Result<bool, IPWorksLLMError>
Default Value
false
Remarks
Whether a trusted_cert_private_key is available for the selected certificate. If trusted_cert_private_key_available is True, the certificate may be used for authentication purposes (e.g., server authentication).
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
bool
trusted_cert_private_key_container property (C2PAVerifier Struct)
The name of the PrivateKey container for the certificate (if available).
Syntax
fn trusted_cert_private_key_container(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The name of the trusted_cert_private_key container for the certificate (if available). This functionality is available only on Windows platforms.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_public_key property (C2PAVerifier Struct)
The public key of the certificate.
Syntax
fn trusted_cert_public_key(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The public key of the certificate. The key is provided as PEM/Base64-encoded data.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_public_key_algorithm property (C2PAVerifier Struct)
The textual description of the certificate's public key algorithm.
Syntax
fn trusted_cert_public_key_algorithm(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_public_key_length property (C2PAVerifier Struct)
The length of the certificate's public key (in bits).
Syntax
fn trusted_cert_public_key_length(&self, TrustedCertIndex : i32) -> Result<i32, IPWorksLLMError>
Default Value
0
Remarks
The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
i32
trusted_cert_serial_number property (C2PAVerifier Struct)
The serial number of the certificate encoded as a string.
Syntax
fn trusted_cert_serial_number(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_signature_algorithm property (C2PAVerifier Struct)
The text description of the certificate's signature algorithm.
Syntax
fn trusted_cert_signature_algorithm(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_store property (C2PAVerifier Struct)
The name of the certificate store for the client certificate.
Syntax
fn trusted_cert_store(&self, TrustedCertIndex : i32) -> Result<Vec<u8>, IPWorksLLMError>
fn set_trusted_cert_store(&self, TrustedCertIndex : i32, value : Vec<u8>) -> Option<IPWorksLLMError> fn set_trusted_cert_store_ref(&self, TrustedCertIndex : i32, value : &[u8]) -> Option<IPWorksLLMError>
Default Value
"MY"
Remarks
The trusted_cert_store_type property denotes the type of the certificate store specified by trusted_cert_store. If the store is password-protected, specify the password in trusted_cert_store_password.
trusted_cert_store is used in conjunction with the trusted_cert_subject property to specify client certificates. If trusted_cert_store has a value, and trusted_cert_subject or trusted_cert_encoded is set, a search for a certificate is initiated. Please see the trusted_cert_subject property for details.
Designations of certificate stores are platform dependent.
The following designations are the most common User and Machine certificate stores in Windows:
| MY | A certificate store holding personal certificates with their associated private keys. |
| CA | Certifying authority certificates. |
| ROOT | Root certificates. |
When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
Data Type
Vec<u8>
trusted_cert_store_password property (C2PAVerifier Struct)
If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.
Syntax
fn trusted_cert_store_password(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
fn set_trusted_cert_store_password(&self, TrustedCertIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_trusted_cert_store_password_ref(&self, TrustedCertIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
Data Type
String
trusted_cert_store_type property (C2PAVerifier Struct)
The type of certificate store for this certificate.
Syntax
fn trusted_cert_store_type(&self, TrustedCertIndex : i32) -> Result<i32, IPWorksLLMError>
fn set_trusted_cert_store_type(&self, TrustedCertIndex : i32, value : i32) -> Option<IPWorksLLMError>
Possible Values
0 // User
1 // Machine
2 // PFXFile
3 // PFXBlob
4 // JKSFile
5 // JKSBlob
6 // PEMKeyFile
7 // PEMKeyBlob
8 // PublicKeyFile
9 // PublicKeyBlob
10 // SSHPublicKeyBlob
11 // P7BFile
12 // P7BBlob
13 // SSHPublicKeyFile
14 // PPKFile
15 // PPKBlob
16 // XMLFile
17 // XMLBlob
18 // JWKFile
19 // JWKBlob
20 // SecurityKey
21 // BCFKSFile
22 // BCFKSBlob
23 // PKCS11
99 // Auto
Default Value
0
Remarks
The struct supports both public and private keys in a variety of formats. When the cstAuto value is used, the struct will automatically determine the type. This property can take one of the following values:
| 0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user.
NOTE: This store type is not available in Java. |
| 1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store.
NOTE: This store type is not available in Java. |
| 2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
| 3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
| 4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates.
NOTE: This store type is only available in Java. |
| 5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format.
NOTE: This store type is only available in Java. |
| 6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
| 7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
| 8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
| 9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
| 10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
| 11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
| 12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
| 13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
| 14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
| 15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
| 16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
| 17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
| 18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
| 19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
| 21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store).
NOTE: This store type is only available in Java and .NET. |
| 22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format.
NOTE: This store type is only available in Java and .NET. |
| 23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface.
To use a security key, create a new Certificate object and pass cstPKCS11 as the trusted_cert_store_type, the full path of the PKCS#11 DLL as the trusted_cert_store, and the PIN as the trusted_cert_store_password. Code Example. SSH Authentication with Security Key (without CertMgr):
Alternatively, collect the necessary data using the CertMgr struct by calling the list_store_certificates method after setting the corresponding properties accordingly. The certificate information returned in the on_cert_list event's CertEncoded parameter may be saved for later use. When using a certificate obtained with this approach, pass the previously saved security key information as the trusted_cert_store and set trusted_cert_store_password to the PIN. Code Example. SSH Authentication with Security Key (with CertMgr):
|
| 99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
Data Type
i32
trusted_cert_subject_alt_names property (C2PAVerifier Struct)
Comma-separated lists of alternative subject names for the certificate.
Syntax
fn trusted_cert_subject_alt_names(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
Comma-separated lists of alternative subject names for the certificate.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_thumbprint_md5 property (C2PAVerifier Struct)
The MD5 hash of the certificate.
Syntax
fn trusted_cert_thumbprint_md5(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_thumbprint_sha1 property (C2PAVerifier Struct)
The SHA-1 hash of the certificate.
Syntax
fn trusted_cert_thumbprint_sha1(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_thumbprint_sha256 property (C2PAVerifier Struct)
The SHA-256 hash of the certificate.
Syntax
fn trusted_cert_thumbprint_sha256(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_usage property (C2PAVerifier Struct)
The text description of UsageFlags .
Syntax
fn trusted_cert_usage(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This value will be one or more of the following strings and will be separated by commas:
- Digital Signature
- Non-Repudiation
- Key Encipherment
- Data Encipherment
- Key Agreement
- Certificate Signing
- CRL Signing
- Encipher Only
If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_usage_flags property (C2PAVerifier Struct)
The flags that show intended use for the certificate.
Syntax
fn trusted_cert_usage_flags(&self, TrustedCertIndex : i32) -> Result<i32, IPWorksLLMError>
Default Value
0
Remarks
The flags that show intended use for the certificate. The value of trusted_cert_usage_flags is a combination of the following flags:
| 0x80 | Digital Signature |
| 0x40 | Non-Repudiation |
| 0x20 | Key Encipherment |
| 0x10 | Data Encipherment |
| 0x08 | Key Agreement |
| 0x04 | Certificate Signing |
| 0x02 | CRL Signing |
| 0x01 | Encipher Only |
Please see the trusted_cert_usage property for a text representation of trusted_cert_usage_flags.
This functionality currently is not available when the provider is OpenSSL.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
i32
trusted_cert_version property (C2PAVerifier Struct)
The certificate's version number.
Syntax
fn trusted_cert_version(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
The certificate's version number. The possible values are the strings "V1", "V2", and "V3".
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
This property is read-only.
Data Type
String
trusted_cert_subject property (C2PAVerifier Struct)
The subject of the certificate used for client authentication.
Syntax
fn trusted_cert_subject(&self, TrustedCertIndex : i32) -> Result<String, IPWorksLLMError>
fn set_trusted_cert_subject(&self, TrustedCertIndex : i32, value : &str) -> Option<IPWorksLLMError> fn set_trusted_cert_subject_ref(&self, TrustedCertIndex : i32, value : &String) -> Option<IPWorksLLMError>
Default Value
""
Remarks
This property must be set after all other certificate properties are set. When this property is set, a search is performed in the current certificate store to locate a certificate with a matching subject.
If a matching certificate is found, the property is set to the full subject of the matching certificate.
If an exact match is not found, the store is searched for subjects containing the value of the property.
If a match is still not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:
| Field | Meaning |
| CN | Common Name. This is commonly a hostname like www.server.com. |
| O | Organization |
| OU | Organizational Unit |
| L | Locality |
| S | State |
| C | Country |
| E | Email Address |
If a field value contains a comma, it must be quoted.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
Data Type
String
trusted_cert_encoded property (C2PAVerifier Struct)
The certificate (PEM/Base64 encoded).
Syntax
fn trusted_cert_encoded(&self, TrustedCertIndex : i32) -> Result<Vec<u8>, IPWorksLLMError>
fn set_trusted_cert_encoded(&self, TrustedCertIndex : i32, value : Vec<u8>) -> Option<IPWorksLLMError> fn set_trusted_cert_encoded_ref(&self, TrustedCertIndex : i32, value : &[u8]) -> Option<IPWorksLLMError>
Default Value
""
Remarks
The certificate (PEM/Base64 encoded). This property is used to assign a specific certificate. The trusted_cert_store and trusted_cert_subject properties also may be used to specify a certificate.
When trusted_cert_encoded is set, a search is initiated in the current trusted_cert_store for the private key of the certificate. If the key is found, trusted_cert_subject is updated to reflect the full subject of the selected certificate; otherwise, trusted_cert_subject is set to an empty string.
The TrustedCertIndex parameter specifies the index of the item in the array. The size of the array is controlled by the trusted_cert_count property.
Data Type
Vec<u8>
use_c2_pa_trust_list property (C2PAVerifier Struct)
Whether the built-in C2PA trust list is used.
Syntax
fn use_c2_pa_trust_list(&self) -> Result<bool, IPWorksLLMError>
fn set_use_c2_pa_trust_list(&self, value : bool) -> Option<IPWorksLLMError>
Default Value
true
Remarks
This property controls whether signing certificates are validated against the C2PA trust list built into the struct, in addition to any anchors in trusted_certs.
The default value is True, which is the configuration the C2PA specification describes for a validator: the trust anchors for the claim signing extended key usage include the C2PA trust list, and a user may configure further anchors on top of it.
Set this property to False to validate against trusted_certs alone, which is appropriate for a private PKI where the public list has no bearing.
The built-in list is a snapshot taken when the struct was built. Query the TrustListVersion and TrustListDate configuration settings to determine how current that snapshot is; supply newer anchors through trusted_certs when it has aged.
Data Type
bool
validation_result_count property (C2PAVerifier Struct)
The number of records in the ValidationResult arrays.
Syntax
fn validation_result_count(&self) -> Result<i32, IPWorksLLMError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- validation_result_code
- validation_result_explanation
- validation_result_manifest_label
- validation_result_severity
This property is read-only.
Data Type
i32
validation_result_code property (C2PAVerifier Struct)
The C2PA status code.
Syntax
fn validation_result_code(&self, ValidationResultIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field holds the status code defined by the C2PA specification, reported verbatim so it can be matched against the specification or passed to another conforming implementation.
Frequently encountered values are:
| claimSignature.validated | The claim signature verified. |
| claimSignature.insideValidity | The signature was made while the certificate was valid. |
| signingCredential.trusted | The signing certificate chains to a trust anchor. |
| assertion.dataHash.match | The asset bytes match what was signed. |
| claimSignature.mismatch | The claim signature did not verify. |
| signingCredential.untrusted | The signing certificate chains to no configured trust anchor. |
| signingCredential.ocsp.revoked | The signing certificate has been revoked. |
| assertion.dataHash.mismatch | The asset was altered after signing. |
The ValidationResultIndex parameter specifies the index of the item in the array. The size of the array is controlled by the validation_result_count property.
This property is read-only.
Data Type
String
validation_result_explanation property (C2PAVerifier Struct)
A human-readable description of the result.
Syntax
fn validation_result_explanation(&self, ValidationResultIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field describes what was checked and what was found, in text suitable for showing to a person or writing to a log.
Application logic should branch on validation_result_code rather than on this text, which is not part of the C2PA specification and may be reworded.
The ValidationResultIndex parameter specifies the index of the item in the array. The size of the array is controlled by the validation_result_count property.
This property is read-only.
Data Type
String
validation_result_manifest_label property (C2PAVerifier Struct)
The manifest the result applies to.
Syntax
fn validation_result_manifest_label(&self, ValidationResultIndex : i32) -> Result<String, IPWorksLLMError>
Default Value
""
Remarks
This field holds the urn:c2pa label of the manifest that was being checked, so results can be attributed correctly when an asset carries a chain of them.
The ValidationResultIndex parameter specifies the index of the item in the array. The size of the array is controlled by the validation_result_count property.
This property is read-only.
Data Type
String
validation_result_severity property (C2PAVerifier Struct)
How serious the result is.
Syntax
fn validation_result_severity(&self, ValidationResultIndex : i32) -> Result<i32, IPWorksLLMError>
Default Value
0
Remarks
This field classifies the result:
| 0 (Success) | The check passed. |
| 1 (Informational) | The check could not be completed, or reports a condition that is neither a pass nor a failure. Revocation that could not be determined lands here. |
| 2 (Failure) | The check failed. The manifest does not validate. |
An asset should be treated as validated only when no result carries a severity of 2 and the successes cover the checks the application requires.
The ValidationResultIndex parameter specifies the index of the item in the array. The size of the array is controlled by the validation_result_count property.
This property is read-only.
Data Type
i32
config method (C2PAVerifier Struct)
Sets or retrieves a configuration setting.
Syntax
fn config(&self, configuration_string : &str) -> Result<String, IPWorksLLMError>
Remarks
config is a generic method available in every struct. It is used to set and retrieve configuration settings for the struct.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, access to these internal properties is provided through the config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
reset method (C2PAVerifier Struct)
This method will reset the struct.
Syntax
fn reset(&self) -> Result<(), IPWorksLLMError>
Remarks
This method will reset the struct's properties to their default values.
verify method (C2PAVerifier Struct)
Extracts and validates the C2PA Manifests in the asset.
Syntax
fn verify(&self) -> Result<(), IPWorksLLMError>
Remarks
This method reads the asset named by input_file (or held in input_data), locates the C2PA Manifest Store, and validates it. manifests and validation_results are populated when it returns.
For the active manifest, the struct verifies the claim signature, builds a certificate path from the signing certificate to the active trust anchors, and recomputes the content binding hash over the asset to confirm the bytes still match what was signed.
C2PAVerifier verifier = new C2PAVerifier();
verifier.InputFile = "photo-signed.jpg";
verifier.Verify();
foreach (C2PAValidationResult result in verifier.ValidationResults)
Console.WriteLine(result.Severity + " " + result.Code + ": " + result.Explanation);
A failed check does not throw. It is reported through validation_results and the on_validation_status event, so that a partially trustworthy asset can be described accurately rather than merely rejected. An error is thrown only when the asset cannot be read at all, or carries no C2PA Manifest.
on_error event (C2PAVerifier Struct)
Fired when information is available about errors during data delivery.
Syntax
// C2PAVerifierErrorEventArgs carries the C2PAVerifier Error event's parameters.
pub struct C2PAVerifierErrorEventArgs {
fn error_code(&self) -> i32
fn description(&self) -> &String
}
// C2PAVerifierErrorEvent defines the signature of the C2PAVerifier Error event's handler function.
pub trait C2PAVerifierErrorEvent {
fn on_error(&self, sender : C2PAVerifier, e : &mut C2PAVerifierErrorEventArgs);
}
impl <'a> C2PAVerifier<'a> {
pub fn on_error(&self) -> &'a dyn C2PAVerifierErrorEvent;
pub fn set_on_error(&mut self, value : &'a dyn C2PAVerifierErrorEvent);
...
}
Remarks
The on_error event is fired in case of exceptional conditions during message processing. Normally the struct fails with an error.
The error_code parameter contains an error code, and the description parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
on_log event (C2PAVerifier Struct)
This event fires once for each log message.
Syntax
// C2PAVerifierLogEventArgs carries the C2PAVerifier Log event's parameters.
pub struct C2PAVerifierLogEventArgs {
fn log_level(&self) -> i32
fn message(&self) -> &String
fn log_type(&self) -> &String
}
// C2PAVerifierLogEvent defines the signature of the C2PAVerifier Log event's handler function.
pub trait C2PAVerifierLogEvent {
fn on_log(&self, sender : C2PAVerifier, e : &mut C2PAVerifierLogEventArgs);
}
impl <'a> C2PAVerifier<'a> {
pub fn on_log(&self) -> &'a dyn C2PAVerifierLogEvent;
pub fn set_on_log(&mut self, value : &'a dyn C2PAVerifierLogEvent);
...
}
Remarks
This event fires once for each log message generated by the struct. The verbosity is controlled by the LogLevel setting.
log_level indicates the level of message. Possible values are as follows:
| 0 (None) | No messages are logged. |
| 1 (Info - default) | Informational events such as the start and completion of a signing or verification operation are logged. |
| 2 (Verbose) | Detailed data such as individual manifest boxes and validation steps are logged. |
| 3 (Debug) | Debug data including byte offsets and hash inputs are logged. |
message is the log entry.
log_type identifies the type of log entry. Possible values are Info, Manifest, Signature, and Validation.
on_manifest_found event (C2PAVerifier Struct)
Fires once for each C2PA Manifest found in the asset.
Syntax
// C2PAVerifierManifestFoundEventArgs carries the C2PAVerifier ManifestFound event's parameters.
pub struct C2PAVerifierManifestFoundEventArgs {
fn manifest_label(&self) -> &String
fn claim_generator(&self) -> &String
fn signer_subject(&self) -> &String
fn is_active(&self) -> bool
}
// C2PAVerifierManifestFoundEvent defines the signature of the C2PAVerifier ManifestFound event's handler function.
pub trait C2PAVerifierManifestFoundEvent {
fn on_manifest_found(&self, sender : C2PAVerifier, e : &mut C2PAVerifierManifestFoundEventArgs);
}
impl <'a> C2PAVerifier<'a> {
pub fn on_manifest_found(&self) -> &'a dyn C2PAVerifierManifestFoundEvent;
pub fn set_on_manifest_found(&mut self, value : &'a dyn C2PAVerifierManifestFoundEvent);
...
}
Remarks
This event fires as each manifest is located, before validation of that manifest completes.
ManifestLabel is the manifest's identifier, a urn:c2pa value. ClaimGenerator names the tool that produced it. SignerSubject is the subject of the certificate that signed the claim. IsActive is True for the active manifest, which is the last one in the store.
The same information is available afterwards through the manifests properties; this event is for applications that would rather report provenance as it is discovered.
on_validation_status event (C2PAVerifier Struct)
Fires once for each validation status code produced.
Syntax
// C2PAVerifierValidationStatusEventArgs carries the C2PAVerifier ValidationStatus event's parameters.
pub struct C2PAVerifierValidationStatusEventArgs {
fn code(&self) -> &String
fn explanation(&self) -> &String
fn severity(&self) -> i32
fn manifest_label(&self) -> &String
}
// C2PAVerifierValidationStatusEvent defines the signature of the C2PAVerifier ValidationStatus event's handler function.
pub trait C2PAVerifierValidationStatusEvent {
fn on_validation_status(&self, sender : C2PAVerifier, e : &mut C2PAVerifierValidationStatusEventArgs);
}
impl <'a> C2PAVerifier<'a> {
pub fn on_validation_status(&self) -> &'a dyn C2PAVerifierValidationStatusEvent;
pub fn set_on_validation_status(&mut self, value : &'a dyn C2PAVerifierValidationStatusEvent);
...
}
Remarks
This event fires as each check completes, giving the same information that is appended to validation_results.
Code is the status code defined by the C2PA specification, reported verbatim. Common values are claimSignature.validated and assertion.dataHash.match on success, assertion.dataHash.mismatch when the asset was altered after signing, and signingCredential.untrusted when the signature is intact but the signer chains to no configured trust anchor.
Explanation is a human-readable description of the check.
Severity is 0 (success), 1 (informational), or 2 (failure).
ManifestLabel identifies which manifest the result applies to.
Config Settings (C2PAVerifier Struct)
The struct accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, access to these internal properties is provided through the config method.C2PAVerifier Config Settings
The C2PA specification requires a validator to reject a certificate used for a purpose it is not authorized for. The default accepts 1.3.6.1.4.1.62558.2.1 (the C2PA claim signing usage), together with 1.3.6.1.5.5.7.3.4 (email protection) and 1.3.6.1.5.5.7.3.36 (document signing), which earlier versions of the specification required instead and which signers still carry.
Two usages are never accepted regardless of this setting: time-stamping and OCSP signing. A certificate valid for either of those is valid for that purpose alone and cannot sign claims.
Base Config Settings
The following is a list of valid code page identifiers:
| Identifier | Name |
| 037 | IBM EBCDIC - U.S./Canada |
| 437 | OEM - United States |
| 500 | IBM EBCDIC - International |
| 708 | Arabic - ASMO 708 |
| 709 | Arabic - ASMO 449+, BCON V4 |
| 710 | Arabic - Transparent Arabic |
| 720 | Arabic - Transparent ASMO |
| 737 | OEM - Greek (formerly 437G) |
| 775 | OEM - Baltic |
| 850 | OEM - Multilingual Latin I |
| 852 | OEM - Latin II |
| 855 | OEM - Cyrillic (primarily Russian) |
| 857 | OEM - Turkish |
| 858 | OEM - Multilingual Latin I + Euro symbol |
| 860 | OEM - Portuguese |
| 861 | OEM - Icelandic |
| 862 | OEM - Hebrew |
| 863 | OEM - Canadian-French |
| 864 | OEM - Arabic |
| 865 | OEM - Nordic |
| 866 | OEM - Russian |
| 869 | OEM - Modern Greek |
| 870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
| 874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
| 875 | IBM EBCDIC - Modern Greek |
| 932 | ANSI/OEM - Japanese, Shift-JIS |
| 936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
| 949 | ANSI/OEM - Korean (Unified Hangul Code) |
| 950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
| 1026 | IBM EBCDIC - Turkish (Latin-5) |
| 1047 | IBM EBCDIC - Latin 1/Open System |
| 1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
| 1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
| 1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
| 1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
| 1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
| 1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
| 1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
| 1147 | IBM EBCDIC - France (20297 + Euro symbol) |
| 1148 | IBM EBCDIC - International (500 + Euro symbol) |
| 1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
| 1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
| 1201 | Unicode UCS-2 Big-Endian |
| 1250 | ANSI - Central European |
| 1251 | ANSI - Cyrillic |
| 1252 | ANSI - Latin I |
| 1253 | ANSI - Greek |
| 1254 | ANSI - Turkish |
| 1255 | ANSI - Hebrew |
| 1256 | ANSI - Arabic |
| 1257 | ANSI - Baltic |
| 1258 | ANSI/OEM - Vietnamese |
| 1361 | Korean (Johab) |
| 10000 | MAC - Roman |
| 10001 | MAC - Japanese |
| 10002 | MAC - Traditional Chinese (Big5) |
| 10003 | MAC - Korean |
| 10004 | MAC - Arabic |
| 10005 | MAC - Hebrew |
| 10006 | MAC - Greek I |
| 10007 | MAC - Cyrillic |
| 10008 | MAC - Simplified Chinese (GB 2312) |
| 10010 | MAC - Romania |
| 10017 | MAC - Ukraine |
| 10021 | MAC - Thai |
| 10029 | MAC - Latin II |
| 10079 | MAC - Icelandic |
| 10081 | MAC - Turkish |
| 10082 | MAC - Croatia |
| 12000 | Unicode UCS-4 Little-Endian |
| 12001 | Unicode UCS-4 Big-Endian |
| 20000 | CNS - Taiwan |
| 20001 | TCA - Taiwan |
| 20002 | Eten - Taiwan |
| 20003 | IBM5550 - Taiwan |
| 20004 | TeleText - Taiwan |
| 20005 | Wang - Taiwan |
| 20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
| 20106 | IA5 German (7-bit) |
| 20107 | IA5 Swedish (7-bit) |
| 20108 | IA5 Norwegian (7-bit) |
| 20127 | US-ASCII (7-bit) |
| 20261 | T.61 |
| 20269 | ISO 6937 Non-Spacing Accent |
| 20273 | IBM EBCDIC - Germany |
| 20277 | IBM EBCDIC - Denmark/Norway |
| 20278 | IBM EBCDIC - Finland/Sweden |
| 20280 | IBM EBCDIC - Italy |
| 20284 | IBM EBCDIC - Latin America/Spain |
| 20285 | IBM EBCDIC - United Kingdom |
| 20290 | IBM EBCDIC - Japanese Katakana Extended |
| 20297 | IBM EBCDIC - France |
| 20420 | IBM EBCDIC - Arabic |
| 20423 | IBM EBCDIC - Greek |
| 20424 | IBM EBCDIC - Hebrew |
| 20833 | IBM EBCDIC - Korean Extended |
| 20838 | IBM EBCDIC - Thai |
| 20866 | Russian - KOI8-R |
| 20871 | IBM EBCDIC - Icelandic |
| 20880 | IBM EBCDIC - Cyrillic (Russian) |
| 20905 | IBM EBCDIC - Turkish |
| 20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
| 20932 | JIS X 0208-1990 & 0121-1990 |
| 20936 | Simplified Chinese (GB2312) |
| 21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
| 21027 | Extended Alpha Lowercase |
| 21866 | Ukrainian (KOI8-U) |
| 28591 | ISO 8859-1 Latin I |
| 28592 | ISO 8859-2 Central Europe |
| 28593 | ISO 8859-3 Latin 3 |
| 28594 | ISO 8859-4 Baltic |
| 28595 | ISO 8859-5 Cyrillic |
| 28596 | ISO 8859-6 Arabic |
| 28597 | ISO 8859-7 Greek |
| 28598 | ISO 8859-8 Hebrew |
| 28599 | ISO 8859-9 Latin 5 |
| 28605 | ISO 8859-15 Latin 9 |
| 29001 | Europa 3 |
| 38598 | ISO 8859-8 Hebrew |
| 50220 | ISO 2022 Japanese with no halfwidth Katakana |
| 50221 | ISO 2022 Japanese with halfwidth Katakana |
| 50222 | ISO 2022 Japanese JIS X 0201-1989 |
| 50225 | ISO 2022 Korean |
| 50227 | ISO 2022 Simplified Chinese |
| 50229 | ISO 2022 Traditional Chinese |
| 50930 | Japanese (Katakana) Extended |
| 50931 | US/Canada and Japanese |
| 50933 | Korean Extended and Korean |
| 50935 | Simplified Chinese Extended and Simplified Chinese |
| 50936 | Simplified Chinese |
| 50937 | US/Canada and Traditional Chinese |
| 50939 | Japanese (Latin) Extended and Japanese |
| 51932 | EUC - Japanese |
| 51936 | EUC - Simplified Chinese |
| 51949 | EUC - Korean |
| 51950 | EUC - Traditional Chinese |
| 52936 | HZ-GB2312 Simplified Chinese |
| 54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
| 57002 | ISCII Devanagari |
| 57003 | ISCII Bengali |
| 57004 | ISCII Tamil |
| 57005 | ISCII Telugu |
| 57006 | ISCII Assamese |
| 57007 | ISCII Oriya |
| 57008 | ISCII Kannada |
| 57009 | ISCII Malayalam |
| 57010 | ISCII Gujarati |
| 57011 | ISCII Punjabi |
| 65000 | Unicode UTF-7 |
| 65001 | Unicode UTF-8 |
| Identifier | Name |
| 1 | ASCII |
| 2 | NEXTSTEP |
| 3 | JapaneseEUC |
| 4 | UTF8 |
| 5 | ISOLatin1 |
| 6 | Symbol |
| 7 | NonLossyASCII |
| 8 | ShiftJIS |
| 9 | ISOLatin2 |
| 10 | Unicode |
| 11 | WindowsCP1251 |
| 12 | WindowsCP1252 |
| 13 | WindowsCP1253 |
| 14 | WindowsCP1254 |
| 15 | WindowsCP1250 |
| 21 | ISO2022JP |
| 30 | MacOSRoman |
| 10 | UTF16String |
| 0x90000100 | UTF16BigEndian |
| 0x94000100 | UTF16LittleEndian |
| 0x8c000100 | UTF32String |
| 0x98000100 | UTF32BigEndian |
| 0x9c000100 | UTF32LittleEndian |
| 65536 | Proprietary |
- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.
Setting this configuration setting to true tells the struct to use the internal implementation instead of using the system security libraries.
On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default.
To use the system security libraries for Linux, OpenSSL support must be enabled. For more information on how to enable OpenSSL, please refer to the OpenSSL Notes section.
Trappable Errors (C2PAVerifier Struct)
C2PAVerifier Errors
| 101 | Unsupported algorithm. The claim signature names a signature algorithm outside the set the C2PA specification permits. |
| 102 | The claim signature carries no usable signing certificate. |
| 103 | Unsupported asset format. The asset is not one of the formats the component can read a C2PA Manifest from. |
| 105 | The claim signature does not fit the space reserved for it in the Manifest. |
| 106 | A required parameter is missing or invalid. |
| 107 | The Manifest could not be laid out. This indicates a defect in the component rather than a problem with the input. |
| 111 | No C2PA Manifest was found in the asset. Most files have never been signed, so an application that inspects arbitrary files should expect this and treat it as an ordinary outcome rather than a failure. |
| 112 | The C2PA Manifest Store is malformed and could not be parsed. |
| 305 | Cannot read file. |