C2PASigner Class

Properties   Methods   Events   Config Settings   Errors  

Creates a C2PA Manifest, signs it, and embeds it into an asset.

Class Name

IPWorksLLM_C2PASigner

Procedural Interface

 ipworksllm_c2pasigner_open();
 ipworksllm_c2pasigner_close($res);
 ipworksllm_c2pasigner_register_callback($res, $id, $function);
 ipworksllm_c2pasigner_get_last_error($res);
 ipworksllm_c2pasigner_get_last_error_code($res);
 ipworksllm_c2pasigner_set($res, $id, $index, $value);
 ipworksllm_c2pasigner_get($res, $id, $index);
 ipworksllm_c2pasigner_do_addaction($res, $action, $digitalsourcetype, $softwareagent);
 ipworksllm_c2pasigner_do_addassertion($res, $assertionlabel, $mediatype, $data);
 ipworksllm_c2pasigner_do_addingredient($res, $sourcefile, $title, $relationship);
 ipworksllm_c2pasigner_do_config($res, $configurationstring);
 ipworksllm_c2pasigner_do_reset($res);
 ipworksllm_c2pasigner_do_sign($res);

Remarks

The C2PASigner class produces Content Credentials: a signed C2PA Manifest that records how an asset was produced, which tool produced it, and whether generative AI was involved. The manifest is embedded directly into the asset, so the provenance travels with the file.

Supported Formats

The class embeds the manifest into the asset itself, so each container format needs its own support. JPEG, PNG and PDF are supported.

JPEGThe manifest travels in APP11 marker segments. Because a JPEG marker segment cannot exceed 64K, a manifest of any size spans several contiguous segments.
PNGThe manifest travels in a single caBX chunk placed before the image data.
PDFThe manifest travels in an embedded file stream, appended to the document as an incremental update. The original bytes of the document are left untouched.

The format is detected from the asset itself; there is nothing to configure. An asset in any other format is refused rather than written incorrectly.

For PDF, only documents using classic cross-reference tables can be signed. A document using cross-reference streams is refused, because appending a table-style update to it would produce a file that readers reject.

Signing an Asset

Set InputFile to the asset to be signed, OutputFile to the destination, and SigningCert to a certificate with an associated private key. Calling Sign builds the manifest, signs it, and writes the result.

C2PASigner signer = new C2PASigner(); signer.InputFile = "photo.jpg"; signer.OutputFile = "photo-signed.jpg"; signer.ClaimGenerator = "MyApp/1.0"; signer.SigningCert = new Certificate(CertStoreTypes.cstPFXFile, "signer.pfx", "password", "*"); signer.Sign();

The signing certificate must carry the C2PA claim signing extended key usage, and the manifest is signed with the algorithm named by SignatureAlgorithm. The permitted algorithms are ES256, ES384, ES512, PS256, PS384, PS512, and Ed25519; the C2PA specification permits no others.

Disclosing AI-Generated Content

The most common reason to sign an asset is to disclose how it was created. The AddAction method records a single action in the manifest. Marking an asset as generative AI output is one call.

signer.AddAction("c2pa.created", "http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia", "MyApp/1.0"); signer.Sign();

The second parameter is the digital source type. The C2PA specification requires that a digital source type accompany the c2pa.created action for every asset; use http://c2pa.org/digitalsourcetype/empty when the asset began as a new file with no digital content.

Adding Other Assertions

Anything beyond the assertions the class computes for itself is added with AddAssertion, which appends a raw assertion payload under a given label. This keeps the API stable as the C2PA standard assertion set evolves.

string creativeWork = "{\"@context\":\"https://schema.org\",\"@type\":\"CreativeWork\",\"author\":[{\"@type\":\"Person\",\"name\":\"Jane Doe\"}]}"; signer.AddAssertion("stds.schema-org.CreativeWork", "application/json", System.Text.Encoding.UTF8.GetBytes(creativeWork));

The content binding assertion, which cryptographically ties the manifest to the asset bytes, is always computed by the class and cannot be supplied by the application. Doing so is what makes tampering detectable.

Trusted Time-Stamps

Setting TSAURL to the address of an RFC 3161 Time Stamping Authority adds a trusted time-stamp to the signature. A time-stamped signature remains verifiable after the signing certificate expires, which is why the C2PA specification recommends obtaining one whenever a TSA can be reached.

signer.TSAURL = "http://timestamp.example.com/tsa"; signer.Sign();

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ActionCountThe number of records in the Action arrays.
ActionThe action identifier.
ActionDigitalSourceTypeThe nature of the content the action produced.
ActionSoftwareAgentThe tool that performed the action.
ActionWhenWhen the action took place.
AssertionCountThe number of records in the Assertion arrays.
AssertionLabelThe assertion label.
AssertionDataThe assertion payload.
AssertionMediaTypeThe media type of the assertion payload.
ClaimGeneratorThe identifier of the tool that created the claim.
IngredientCountThe number of records in the Ingredient arrays.
IngredientFormatThe media type of the ingredient asset.
IngredientInstanceIdThe instance identifier of the ingredient asset.
IngredientManifestLabelThe label of the ingredient's own C2PA Manifest.
IngredientRelationshipHow the ingredient relates to the asset.
IngredientTitleA human-readable name for the ingredient.
InputDataThe asset to process, held in memory.
InputFileThe asset to process.
OutputDataThe signed asset, held in memory.
OutputFileThe file to write the signed asset to.
OverwriteWhether the class may overwrite an existing output file.
SignatureAlgorithmThe algorithm used to sign the claim.
SigningCertEffectiveDateThe date on which this certificate becomes valid.
SigningCertExpirationDateThe date on which the certificate expires.
SigningCertExtendedKeyUsageA comma-delimited list of extended key usage identifiers.
SigningCertFingerprintThe hex-encoded, 16-byte MD5 fingerprint of the certificate.
SigningCertFingerprintSHA1The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.
SigningCertFingerprintSHA256The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.
SigningCertIssuerThe issuer of the certificate.
SigningCertPrivateKeyThe private key of the certificate (if available).
SigningCertPrivateKeyAvailableWhether a PrivateKey is available for the selected certificate.
SigningCertPrivateKeyContainerThe name of the PrivateKey container for the certificate (if available).
SigningCertPublicKeyThe public key of the certificate.
SigningCertPublicKeyAlgorithmThe textual description of the certificate's public key algorithm.
SigningCertPublicKeyLengthThe length of the certificate's public key (in bits).
SigningCertSerialNumberThe serial number of the certificate encoded as a string.
SigningCertSignatureAlgorithmThe text description of the certificate's signature algorithm.
SigningCertStoreThe name of the certificate store for the client certificate.
SigningCertStorePasswordIf the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.
SigningCertStoreTypeThe type of certificate store for this certificate.
SigningCertSubjectAltNamesComma-separated lists of alternative subject names for the certificate.
SigningCertThumbprintMD5The MD5 hash of the certificate.
SigningCertThumbprintSHA1The SHA-1 hash of the certificate.
SigningCertThumbprintSHA256The SHA-256 hash of the certificate.
SigningCertUsageThe text description of UsageFlags .
SigningCertUsageFlagsThe flags that show intended use for the certificate.
SigningCertVersionThe certificate's version number.
SigningCertSubjectThe subject of the certificate used for client authentication.
SigningCertEncodedThe certificate (PEM/Base64 encoded).
TSAURLThe address of an RFC 3161 Time Stamping Authority.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AddActionRecords an action in the C2PA Manifest.
AddAssertionAppends an assertion to the Assertions collection.
AddIngredientRecords that an asset went into the one being signed.
ConfigSets or retrieves a configuration setting.
ResetThis method will reset the class.
SignBuilds, signs, and embeds a C2PA Manifest.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ErrorFired when information is available about errors during data delivery.
LogThis event fires once for each log message.

Config Settings


The following is a list of config settings for the class with short descriptions. Click on the links for further details.

HashAlgorithmThe hash algorithm used for the content binding.
IncludeThumbnailWhether a claim thumbnail is embedded in the manifest.
InstanceIdThe instance identifier recorded in the claim.
LogLevelThe level of detail logged through the Log event.
SignaturePaddingThe number of bytes reserved for the claim signature.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
MaskSensitiveDataWhether sensitive data is masked in log messages.
UseInternalSecurityAPIWhether or not to use the system security libraries or an internal implementation.

ActionCount Property (IPWorksLLM_C2PASigner Class)

The number of records in the Action arrays.

Object Oriented Interface

public function getActionCount();
public function setActionCount($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 1);
ipworksllm_c2pasigner_set($res, 1, $value);

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at ActionCount - 1.

This property is not available at design time.

Data Type

Integer

Action Property (IPWorksLLM_C2PASigner Class)

The action identifier.

Object Oriented Interface

public function getAction($actionindex);
public function setAction($actionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 2, $actionindex);
ipworksllm_c2pasigner_set($res, 2, $value, $actionindex);

Default Value

''

Remarks

The action identifier.

This field holds the C2PA action identifier. Values defined by the specification include c2pa.created, c2pa.edited, c2pa.opened, c2pa.placed, c2pa.converted, and c2pa.published.

The first action in a manifest describes how the asset came into being, and is normally c2pa.created.

The $actionindex parameter specifies the index of the item in the array. The size of the array is controlled by the ActionCount property.

This property is not available at design time.

Data Type

String

ActionDigitalSourceType Property (IPWorksLLM_C2PASigner Class)

The nature of the content the action produced.

Object Oriented Interface

public function getActionDigitalSourceType($actionindex);
public function setActionDigitalSourceType($actionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 3, $actionindex);
ipworksllm_c2pasigner_set($res, 3, $value, $actionindex);

Default Value

''

Remarks

The nature of the content the action produced.

This field identifies what kind of content resulted from the action, using a term from the IPTC digital source type vocabulary or one of the C2PA-specific values.

The C2PA specification requires that a digital source type accompany the c2pa.created action for every asset. Commonly used values are:

http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMediaMedia produced by a generative model.
http://cv.iptc.org/newscodes/digitalsourcetype/digitalCaptureCaptured by a camera or other recording device.
http://cv.iptc.org/newscodes/digitalsourcetype/compositeWithTrainedAlgorithmicMediaA composite that includes generated elements.
http://c2pa.org/digitalsourcetype/emptyThe asset began as a new file with no digital content.

No digital source type is required with a c2pa.opened action.

The $actionindex parameter specifies the index of the item in the array. The size of the array is controlled by the ActionCount property.

This property is not available at design time.

Data Type

String

ActionSoftwareAgent Property (IPWorksLLM_C2PASigner Class)

The tool that performed the action.

Object Oriented Interface

public function getActionSoftwareAgent($actionindex);
public function setActionSoftwareAgent($actionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 4, $actionindex);
ipworksllm_c2pasigner_set($res, 4, $value, $actionindex);

Default Value

''

Remarks

The tool that performed the action.

This field names the software that carried out the action, for example MyApp/1.0.

It answers a different question from the manifest's claim generator: the claim generator is whatever wrote the provenance data, while this field is whatever actually edited the asset. They are often, but not always, the same tool.

The $actionindex parameter specifies the index of the item in the array. The size of the array is controlled by the ActionCount property.

This property is not available at design time.

Data Type

String

ActionWhen Property (IPWorksLLM_C2PASigner Class)

When the action took place.

Object Oriented Interface

public function getActionWhen($actionindex);
public function setActionWhen($actionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 5, $actionindex);
ipworksllm_c2pasigner_set($res, 5, $value, $actionindex);

Default Value

''

Remarks

When the action took place.

This field holds the time the action was performed, as an RFC 3339 date and time.

The C2PA specification requires an explicit timezone or a trailing Z for UTC. When this field is left empty, no time is recorded for the action.

Note that this is a claimed time, asserted by whoever signed the manifest. It is not the same as a trusted time-stamp, which is obtained from a Time Stamping Authority and is what a validator relies on to establish when the signature actually existed.

The $actionindex parameter specifies the index of the item in the array. The size of the array is controlled by the ActionCount property.

This property is not available at design time.

Data Type

String

AssertionCount Property (IPWorksLLM_C2PASigner Class)

The number of records in the Assertion arrays.

Object Oriented Interface

public function getAssertionCount();
public function setAssertionCount($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 6);
ipworksllm_c2pasigner_set($res, 6, $value);

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at AssertionCount - 1.

This property is not available at design time.

Data Type

Integer

AssertionLabel Property (IPWorksLLM_C2PASigner Class)

The assertion label.

Object Oriented Interface

public function getAssertionLabel($assertionindex);
public function setAssertionLabel($assertionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 7, $assertionindex);
ipworksllm_c2pasigner_set($res, 7, $value, $assertionindex);

Default Value

''

Remarks

The assertion label.

This field holds the C2PA assertion label, which identifies what kind of statement the assertion makes and therefore how AssertionData should be interpreted.

Examples are c2pa.actions.v2, c2pa.hash.data, stds.schema-org.CreativeWork, and stds.exif.

The $assertionindex parameter specifies the index of the item in the array. The size of the array is controlled by the AssertionCount property.

This property is not available at design time.

Data Type

String

AssertionData Property (IPWorksLLM_C2PASigner Class)

The assertion payload.

Object Oriented Interface

public function getAssertionData($assertionindex);
public function setAssertionData($assertionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 8, $assertionindex);
ipworksllm_c2pasigner_set($res, 8, $value, $assertionindex);

Default Value

''

Remarks

The assertion payload.

This field holds the assertion's payload, encoded according to AssertionMediaType.

The payload is passed through verbatim in both directions. An application can therefore write assertion types the class has no built-in knowledge of, and read back ones added to the standard after the class was built.

The $assertionindex parameter specifies the index of the item in the array. The size of the array is controlled by the AssertionCount property.

This property is not available at design time.

Data Type

Binary String

AssertionMediaType Property (IPWorksLLM_C2PASigner Class)

The media type of the assertion payload.

Object Oriented Interface

public function getAssertionMediaType($assertionindex);
public function setAssertionMediaType($assertionindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 9, $assertionindex);
ipworksllm_c2pasigner_set($res, 9, $value, $assertionindex);

Default Value

'application/cbor'

Remarks

The media type of the assertion payload.

This field holds the media type of AssertionData, normally application/cbor or application/json.

The C2PA specification requires that assertions it defines be serialized as CBOR, so application/cbor is the default.

The $assertionindex parameter specifies the index of the item in the array. The size of the array is controlled by the AssertionCount property.

This property is not available at design time.

Data Type

String

ClaimGenerator Property (IPWorksLLM_C2PASigner Class)

The identifier of the tool that created the claim.

Object Oriented Interface

public function getClaimGenerator();
public function setClaimGenerator($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 10);
ipworksllm_c2pasigner_set($res, 10, $value);

Default Value

''

Remarks

This property identifies the application that produced the C2PA Manifest, and is recorded in the claim so a consumer can see which tool made the provenance assertion.

Use a name and version, for example MyApp/1.0. When this property is left empty, the class records its own name and version.

This property is not available at design time.

Data Type

String

IngredientCount Property (IPWorksLLM_C2PASigner Class)

The number of records in the Ingredient arrays.

Object Oriented Interface

public function getIngredientCount();
public function setIngredientCount($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 11);
ipworksllm_c2pasigner_set($res, 11, $value);

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at IngredientCount - 1.

This property is not available at design time.

Data Type

Integer

IngredientFormat Property (IPWorksLLM_C2PASigner Class)

The media type of the ingredient asset.

Object Oriented Interface

public function getIngredientFormat($ingredientindex);
public function setIngredientFormat($ingredientindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 12, $ingredientindex);
ipworksllm_c2pasigner_set($res, 12, $value, $ingredientindex);

Default Value

''

Remarks

The media type of the ingredient asset.

This field holds the media type of the asset that went into this one, for example image/jpeg, image/png or application/pdf. The class 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 IngredientCount property.

This property is not available at design time.

Data Type

String

IngredientInstanceId Property (IPWorksLLM_C2PASigner Class)

The instance identifier of the ingredient asset.

Object Oriented Interface

public function getIngredientInstanceId($ingredientindex);
public function setIngredientInstanceId($ingredientindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 13, $ingredientindex);
ipworksllm_c2pasigner_set($res, 13, $value, $ingredientindex);

Default Value

''

Remarks

The instance identifier of the ingredient asset.

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 class 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 class 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 IngredientCount property.

This property is not available at design time.

Data Type

String

IngredientManifestLabel Property (IPWorksLLM_C2PASigner Class)

The label of the ingredient's own C2PA Manifest.

Object Oriented Interface

public function getIngredientManifestLabel($ingredientindex);
public function setIngredientManifestLabel($ingredientindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 14, $ingredientindex);
ipworksllm_c2pasigner_set($res, 14, $value, $ingredientindex);

Default Value

''

Remarks

The label of the ingredient's own C2PA Manifest.

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 IngredientCount property.

This property is not available at design time.

Data Type

String

IngredientRelationship Property (IPWorksLLM_C2PASigner Class)

How the ingredient relates to the asset.

Object Oriented Interface

public function getIngredientRelationship($ingredientindex);
public function setIngredientRelationship($ingredientindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 15, $ingredientindex);
ipworksllm_c2pasigner_set($res, 15, $value, $ingredientindex);

Default Value

'componentOf'

Remarks

How the ingredient relates to the asset.

This field describes the ingredient's role. The C2PA specification defines the following values:

parentOfThe asset is a derivative of this ingredient. There is at most one parent.
componentOfThe ingredient was placed into the asset alongside other content.
inputToThe 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 IngredientCount property.

This property is not available at design time.

Data Type

String

IngredientTitle Property (IPWorksLLM_C2PASigner Class)

A human-readable name for the ingredient.

Object Oriented Interface

public function getIngredientTitle($ingredientindex);
public function setIngredientTitle($ingredientindex, $value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 16, $ingredientindex);
ipworksllm_c2pasigner_set($res, 16, $value, $ingredientindex);

Default Value

''

Remarks

A human-readable name for the ingredient.

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 IngredientCount property.

This property is not available at design time.

Data Type

String

InputData Property (IPWorksLLM_C2PASigner Class)

The asset to process, held in memory.

Object Oriented Interface

public function getInputData();
public function setInputData($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 17);
ipworksllm_c2pasigner_set($res, 17, $value);

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 InputFile and this property are set, InputFile takes precedence.

Data Type

Binary String

InputFile Property (IPWorksLLM_C2PASigner Class)

The asset to process.

Object Oriented Interface

public function getInputFile();
public function setInputFile($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 18);
ipworksllm_c2pasigner_set($res, 18, $value);

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 InputData are set, this property takes precedence.

Data Type

String

OutputData Property (IPWorksLLM_C2PASigner Class)

The signed asset, held in memory.

Object Oriented Interface

public function getOutputData();

Procedural Interface

ipworksllm_c2pasigner_get($res, 19);

Default Value

''

Remarks

This property holds the signed asset after the operation completes, when OutputFile was left empty.

This property is read-only.

Data Type

Binary String

OutputFile Property (IPWorksLLM_C2PASigner Class)

The file to write the signed asset to.

Object Oriented Interface

public function getOutputFile();
public function setOutputFile($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 20);
ipworksllm_c2pasigner_set($res, 20, $value);

Default Value

''

Remarks

This property specifies where the signed asset is written. Set it to the full or relative path of the destination file.

If this property is empty, the signed asset is written to OutputData instead.

An error is thrown if the file already exists and Overwrite is False.

Data Type

String

Overwrite Property (IPWorksLLM_C2PASigner Class)

Whether the class may overwrite an existing output file.

Object Oriented Interface

public function getOverwrite();
public function setOverwrite($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 21);
ipworksllm_c2pasigner_set($res, 21, $value);

Default Value

false

Remarks

This property indicates whether the class will overwrite OutputFile. When it is False, an error is thrown if OutputFile already exists.

The default value is False.

Data Type

Boolean

SignatureAlgorithm Property (IPWorksLLM_C2PASigner Class)

The algorithm used to sign the claim.

Object Oriented Interface

public function getSignatureAlgorithm();
public function setSignatureAlgorithm($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 22);
ipworksllm_c2pasigner_set($res, 22, $value);

Default Value

'ES256'

Remarks

This property specifies the signature algorithm. The C2PA specification permits only the following values, and no others:

ES256ECDSA with SHA-256.
ES384ECDSA with SHA-384.
ES512ECDSA with SHA-512.
PS256RSASSA-PSS using SHA-256 and MGF1 with SHA-256.
PS384RSASSA-PSS using SHA-384 and MGF1 with SHA-384.
PS512RSASSA-PSS using SHA-512 and MGF1 with SHA-512.
Ed25519EdDSA on the edwards25519 curve. No other EdDSA instance is allowed.

The value must be compatible with the key in SigningCert. The default value is ES256.

This property is not available at design time.

Data Type

String

SigningCertEffectiveDate Property (IPWorksLLM_C2PASigner Class)

The date on which this certificate becomes valid.

Object Oriented Interface

public function getSigningCertEffectiveDate();

Procedural Interface

ipworksllm_c2pasigner_get($res, 23);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertExpirationDate Property (IPWorksLLM_C2PASigner Class)

The date on which the certificate expires.

Object Oriented Interface

public function getSigningCertExpirationDate();

Procedural Interface

ipworksllm_c2pasigner_get($res, 24);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertExtendedKeyUsage Property (IPWorksLLM_C2PASigner Class)

A comma-delimited list of extended key usage identifiers.

Object Oriented Interface

public function getSigningCertExtendedKeyUsage();

Procedural Interface

ipworksllm_c2pasigner_get($res, 25);

Default Value

''

Remarks

A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).

This property is read-only and not available at design time.

Data Type

String

SigningCertFingerprint Property (IPWorksLLM_C2PASigner Class)

The hex-encoded, 16-byte MD5 fingerprint of the certificate.

Object Oriented Interface

public function getSigningCertFingerprint();

Procedural Interface

ipworksllm_c2pasigner_get($res, 26);

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

This property is read-only and not available at design time.

Data Type

String

SigningCertFingerprintSHA1 Property (IPWorksLLM_C2PASigner Class)

The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.

Object Oriented Interface

public function getSigningCertFingerprintSHA1();

Procedural Interface

ipworksllm_c2pasigner_get($res, 27);

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

This property is read-only and not available at design time.

Data Type

String

SigningCertFingerprintSHA256 Property (IPWorksLLM_C2PASigner Class)

The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.

Object Oriented Interface

public function getSigningCertFingerprintSHA256();

Procedural Interface

ipworksllm_c2pasigner_get($res, 28);

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

This property is read-only and not available at design time.

Data Type

String

SigningCertIssuer Property (IPWorksLLM_C2PASigner Class)

The issuer of the certificate.

Object Oriented Interface

public function getSigningCertIssuer();

Procedural Interface

ipworksllm_c2pasigner_get($res, 29);

Default Value

''

Remarks

The issuer of the certificate. This property contains a string representation of the name of the issuing authority for the certificate.

This property is read-only and not available at design time.

Data Type

String

SigningCertPrivateKey Property (IPWorksLLM_C2PASigner Class)

The private key of the certificate (if available).

Object Oriented Interface

public function getSigningCertPrivateKey();

Procedural Interface

ipworksllm_c2pasigner_get($res, 30);

Default Value

''

Remarks

The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.

NOTE: The SigningCertPrivateKey may be available but not exportable. In this case, SigningCertPrivateKey returns an empty string.

This property is read-only and not available at design time.

Data Type

String

SigningCertPrivateKeyAvailable Property (IPWorksLLM_C2PASigner Class)

Whether a PrivateKey is available for the selected certificate.

Object Oriented Interface

public function getSigningCertPrivateKeyAvailable();

Procedural Interface

ipworksllm_c2pasigner_get($res, 31);

Default Value

false

Remarks

Whether a SigningCertPrivateKey is available for the selected certificate. If SigningCertPrivateKeyAvailable is True, the certificate may be used for authentication purposes (e.g., server authentication).

This property is read-only and not available at design time.

Data Type

Boolean

SigningCertPrivateKeyContainer Property (IPWorksLLM_C2PASigner Class)

The name of the PrivateKey container for the certificate (if available).

Object Oriented Interface

public function getSigningCertPrivateKeyContainer();

Procedural Interface

ipworksllm_c2pasigner_get($res, 32);

Default Value

''

Remarks

The name of the SigningCertPrivateKey container for the certificate (if available). This functionality is available only on Windows platforms.

This property is read-only and not available at design time.

Data Type

String

SigningCertPublicKey Property (IPWorksLLM_C2PASigner Class)

The public key of the certificate.

Object Oriented Interface

public function getSigningCertPublicKey();

Procedural Interface

ipworksllm_c2pasigner_get($res, 33);

Default Value

''

Remarks

The public key of the certificate. The key is provided as PEM/Base64-encoded data.

This property is read-only and not available at design time.

Data Type

String

SigningCertPublicKeyAlgorithm Property (IPWorksLLM_C2PASigner Class)

The textual description of the certificate's public key algorithm.

Object Oriented Interface

public function getSigningCertPublicKeyAlgorithm();

Procedural Interface

ipworksllm_c2pasigner_get($res, 34);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertPublicKeyLength Property (IPWorksLLM_C2PASigner Class)

The length of the certificate's public key (in bits).

Object Oriented Interface

public function getSigningCertPublicKeyLength();

Procedural Interface

ipworksllm_c2pasigner_get($res, 35);

Default Value

0

Remarks

The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.

This property is read-only and not available at design time.

Data Type

Integer

SigningCertSerialNumber Property (IPWorksLLM_C2PASigner Class)

The serial number of the certificate encoded as a string.

Object Oriented Interface

public function getSigningCertSerialNumber();

Procedural Interface

ipworksllm_c2pasigner_get($res, 36);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertSignatureAlgorithm Property (IPWorksLLM_C2PASigner Class)

The text description of the certificate's signature algorithm.

Object Oriented Interface

public function getSigningCertSignatureAlgorithm();

Procedural Interface

ipworksllm_c2pasigner_get($res, 37);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertStore Property (IPWorksLLM_C2PASigner Class)

The name of the certificate store for the client certificate.

Object Oriented Interface

public function getSigningCertStore();
public function setSigningCertStore($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 38);
ipworksllm_c2pasigner_set($res, 38, $value);

Default Value

'MY'

Remarks

The name of the certificate store for the client certificate.

The SigningCertStoreType property denotes the type of the certificate store specified by SigningCertStore. If the store is password-protected, specify the password in SigningCertStorePassword.

SigningCertStore is used in conjunction with the SigningCertSubject property to specify client certificates. If SigningCertStore has a value, and SigningCertSubject or SigningCertEncoded is set, a search for a certificate is initiated. Please see the SigningCertSubject property for details.

Designations of certificate stores are platform dependent.

The following designations are the most common User and Machine certificate stores in Windows:

MYA certificate store holding personal certificates with their associated private keys.
CACertifying authority certificates.
ROOTRoot 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).

This property is not available at design time.

Data Type

Binary String

SigningCertStorePassword Property (IPWorksLLM_C2PASigner Class)

If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.

Object Oriented Interface

public function getSigningCertStorePassword();
public function setSigningCertStorePassword($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 39);
ipworksllm_c2pasigner_set($res, 39, $value);

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.

This property is not available at design time.

Data Type

String

SigningCertStoreType Property (IPWorksLLM_C2PASigner Class)

The type of certificate store for this certificate.

Object Oriented Interface

public function getSigningCertStoreType();
public function setSigningCertStoreType($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 40);
ipworksllm_c2pasigner_set($res, 40, $value);

Possible Values

C2PASIGNER_SIGNINGCERTSTORETYPE_USER(0), 
C2PASIGNER_SIGNINGCERTSTORETYPE_MACHINE(1),
C2PASIGNER_SIGNINGCERTSTORETYPE_PFXFILE(2),
C2PASIGNER_SIGNINGCERTSTORETYPE_PFXBLOB(3),
C2PASIGNER_SIGNINGCERTSTORETYPE_JKSFILE(4),
C2PASIGNER_SIGNINGCERTSTORETYPE_JKSBLOB(5),
C2PASIGNER_SIGNINGCERTSTORETYPE_PEMKEY_FILE(6),
C2PASIGNER_SIGNINGCERTSTORETYPE_PEMKEY_BLOB(7),
C2PASIGNER_SIGNINGCERTSTORETYPE_PUBLIC_KEY_FILE(8),
C2PASIGNER_SIGNINGCERTSTORETYPE_PUBLIC_KEY_BLOB(9),
C2PASIGNER_SIGNINGCERTSTORETYPE_SSHPUBLIC_KEY_BLOB(10),
C2PASIGNER_SIGNINGCERTSTORETYPE_P7BFILE(11),
C2PASIGNER_SIGNINGCERTSTORETYPE_P7BBLOB(12),
C2PASIGNER_SIGNINGCERTSTORETYPE_SSHPUBLIC_KEY_FILE(13),
C2PASIGNER_SIGNINGCERTSTORETYPE_PPKFILE(14),
C2PASIGNER_SIGNINGCERTSTORETYPE_PPKBLOB(15),
C2PASIGNER_SIGNINGCERTSTORETYPE_XMLFILE(16),
C2PASIGNER_SIGNINGCERTSTORETYPE_XMLBLOB(17),
C2PASIGNER_SIGNINGCERTSTORETYPE_JWKFILE(18),
C2PASIGNER_SIGNINGCERTSTORETYPE_JWKBLOB(19),
C2PASIGNER_SIGNINGCERTSTORETYPE_SECURITY_KEY(20),
C2PASIGNER_SIGNINGCERTSTORETYPE_BCFKSFILE(21),
C2PASIGNER_SIGNINGCERTSTORETYPE_BCFKSBLOB(22),
C2PASIGNER_SIGNINGCERTSTORETYPE_PKCS11(23),
C2PASIGNER_SIGNINGCERTSTORETYPE_AUTO(99)

Default Value

0

Remarks

The type of certificate store for this certificate.

The class supports both public and private keys in a variety of formats. When the cstAuto value is used, the class 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 SigningCertStoreType, the full path of the PKCS#11 DLL as the SigningCertStore, and the PIN as the SigningCertStorePassword.

Code Example. SSH Authentication with Security Key (without CertMgr): sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11, @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll", "123456", // PIN "CN=cert_subject"); sftp.SSHUser = "test"; sftp.SSHLogon("myhost", 22);

Alternatively, collect the necessary data using the CertMgr class by calling the ListStoreCertificates method after setting the corresponding properties accordingly. The certificate information returned in the CertList 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 SigningCertStore and set SigningCertStorePassword to the PIN.

Code Example. SSH Authentication with Security Key (with CertMgr): certmgr.CertStoreType = CertStoreTypes.cstPKCS11; certmgr.OnCertList += (s, e) => { secKeyBlob = e.CertEncoded; }; certmgr.CertStore = @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll"; certmgr.CertStorePassword = "123456"; // PIN certmgr.ListStoreCertificates(); sftp.SSHCert = new Certificate(CertStoreTypes.cstPKCS11, secKeyBlob, "123456", "*"); sftp.SSHUser = "test"; sftp.SSHLogon("myhost", 22);

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.

This property is not available at design time.

Data Type

Integer

SigningCertSubjectAltNames Property (IPWorksLLM_C2PASigner Class)

Comma-separated lists of alternative subject names for the certificate.

Object Oriented Interface

public function getSigningCertSubjectAltNames();

Procedural Interface

ipworksllm_c2pasigner_get($res, 41);

Default Value

''

Remarks

Comma-separated lists of alternative subject names for the certificate.

This property is read-only and not available at design time.

Data Type

String

SigningCertThumbprintMD5 Property (IPWorksLLM_C2PASigner Class)

The MD5 hash of the certificate.

Object Oriented Interface

public function getSigningCertThumbprintMD5();

Procedural Interface

ipworksllm_c2pasigner_get($res, 42);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertThumbprintSHA1 Property (IPWorksLLM_C2PASigner Class)

The SHA-1 hash of the certificate.

Object Oriented Interface

public function getSigningCertThumbprintSHA1();

Procedural Interface

ipworksllm_c2pasigner_get($res, 43);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertThumbprintSHA256 Property (IPWorksLLM_C2PASigner Class)

The SHA-256 hash of the certificate.

Object Oriented Interface

public function getSigningCertThumbprintSHA256();

Procedural Interface

ipworksllm_c2pasigner_get($res, 44);

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertUsage Property (IPWorksLLM_C2PASigner Class)

The text description of UsageFlags .

Object Oriented Interface

public function getSigningCertUsage();

Procedural Interface

ipworksllm_c2pasigner_get($res, 45);

Default Value

''

Remarks

The text description of SigningCertUsageFlags.

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.

This property is read-only and not available at design time.

Data Type

String

SigningCertUsageFlags Property (IPWorksLLM_C2PASigner Class)

The flags that show intended use for the certificate.

Object Oriented Interface

public function getSigningCertUsageFlags();

Procedural Interface

ipworksllm_c2pasigner_get($res, 46);

Default Value

0

Remarks

The flags that show intended use for the certificate. The value of SigningCertUsageFlags is a combination of the following flags:

0x80Digital Signature
0x40Non-Repudiation
0x20Key Encipherment
0x10Data Encipherment
0x08Key Agreement
0x04Certificate Signing
0x02CRL Signing
0x01Encipher Only

Please see the SigningCertUsage property for a text representation of SigningCertUsageFlags.

This functionality currently is not available when the provider is OpenSSL.

This property is read-only and not available at design time.

Data Type

Integer

SigningCertVersion Property (IPWorksLLM_C2PASigner Class)

The certificate's version number.

Object Oriented Interface

public function getSigningCertVersion();

Procedural Interface

ipworksllm_c2pasigner_get($res, 47);

Default Value

''

Remarks

The certificate's version number. The possible values are the strings "V1", "V2", and "V3".

This property is read-only and not available at design time.

Data Type

String

SigningCertSubject Property (IPWorksLLM_C2PASigner Class)

The subject of the certificate used for client authentication.

Object Oriented Interface

public function getSigningCertSubject();
public function setSigningCertSubject($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 48);
ipworksllm_c2pasigner_set($res, 48, $value);

Default Value

''

Remarks

The subject of the certificate used for client authentication.

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:

FieldMeaning
CNCommon Name. This is commonly a hostname like www.server.com.
OOrganization
OUOrganizational Unit
LLocality
SState
CCountry
EEmail Address

If a field value contains a comma, it must be quoted.

This property is not available at design time.

Data Type

String

SigningCertEncoded Property (IPWorksLLM_C2PASigner Class)

The certificate (PEM/Base64 encoded).

Object Oriented Interface

public function getSigningCertEncoded();
public function setSigningCertEncoded($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 49);
ipworksllm_c2pasigner_set($res, 49, $value);

Default Value

''

Remarks

The certificate (PEM/Base64 encoded). This property is used to assign a specific certificate. The SigningCertStore and SigningCertSubject properties also may be used to specify a certificate.

When SigningCertEncoded is set, a search is initiated in the current SigningCertStore for the private key of the certificate. If the key is found, SigningCertSubject is updated to reflect the full subject of the selected certificate; otherwise, SigningCertSubject is set to an empty string.

This property is not available at design time.

Data Type

Binary String

TSAURL Property (IPWorksLLM_C2PASigner Class)

The address of an RFC 3161 Time Stamping Authority.

Object Oriented Interface

public function getTSAURL();
public function setTSAURL($value);

Procedural Interface

ipworksllm_c2pasigner_get($res, 50);
ipworksllm_c2pasigner_set($res, 50, $value);

Default Value

''

Remarks

This property specifies the Time Stamping Authority contacted during signing. When it is set, the class obtains a trusted time-stamp over the signature and embeds it in the C2PA Manifest as a countersignature.

A time-stamped signature stays verifiable after the signing certificate expires, because a validator can establish that the signature existed while the certificate was still valid. The C2PA specification recommends obtaining a time-stamp whenever a TSA can be reached at signing time.

When this property is empty, no time-stamp is requested.

When it is set and the authority cannot be reached, or returns no token, signing fails rather than producing an untimestamped Manifest. Asking for a time-stamp and quietly getting none would leave a signature that looks complete but loses its meaning the day the certificate expires.

The connection to the authority is authenticated like any other: a TSA presenting an untrusted or expired certificate is refused. There is no event for overriding that decision.

This property is not available at design time.

Data Type

String

AddAction Method (IPWorksLLM_C2PASigner Class)

Records an action in the C2PA Manifest.

Object Oriented Interface

public function doAddAction($action, $digitalsourcetype, $softwareagent);

Procedural Interface

ipworksllm_c2pasigner_do_addaction($res, $action, $digitalsourcetype, $softwareagent);

Remarks

This method appends an action to the manifest's actions assertion, creating that assertion if it does not exist yet.

Action is the C2PA action identifier, such as c2pa.created, c2pa.edited, c2pa.opened, or c2pa.placed.

DigitalSourceType describes the nature of the content the action produced. The C2PA specification requires that a digital source type accompany the c2pa.created action for every asset. Commonly used values are:

http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMediaMedia produced by a generative model.
http://cv.iptc.org/newscodes/digitalsourcetype/digitalCaptureCaptured by a camera or other recording device.
http://c2pa.org/digitalsourcetype/emptyThe asset began as a new file with no digital content.

Other values defined by the IPTC digital source type vocabulary may also be used. Pass an empty string when the action does not take one; a c2pa.opened action, for example, requires none.

SoftwareAgent names the tool that performed the action.

Disclosing AI-generated content is a single call:

signer.AddAction("c2pa.created", "http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia", "MyApp/1.0");

AddAssertion Method (IPWorksLLM_C2PASigner Class)

Appends an assertion to the Assertions collection.

Object Oriented Interface

public function doAddAssertion($assertionlabel, $mediatype, $data);

Procedural Interface

ipworksllm_c2pasigner_do_addassertion($res, $assertionlabel, $mediatype, $data);

Remarks

This method appends a new C2PAAssertion item to the Assertions properties.

AssertionLabel is the C2PA assertion label, such as stds.schema-org.CreativeWork or stds.exif. MediaType is the payload's media type, normally application/json or application/cbor. Data is the assertion payload.

Passing the payload through verbatim keeps the API stable as the C2PA standard assertion set evolves: a new assertion type can be written without waiting for a new build of the class.

string creativeWork = "{\"@context\":\"https://schema.org\",\"@type\":\"CreativeWork\",\"author\":[{\"@type\":\"Person\",\"name\":\"Jane Doe\"}]}"; signer.AddAssertion("stds.schema-org.CreativeWork", "application/json", System.Text.Encoding.UTF8.GetBytes(creativeWork));

Use AddAction instead when recording an action, since it builds the correctly structured actions assertion for you.

AddIngredient Method (IPWorksLLM_C2PASigner Class)

Records that an asset went into the one being signed.

Object Oriented Interface

public function doAddIngredient($sourcefile, $title, $relationship);

Procedural Interface

ipworksllm_c2pasigner_do_addingredient($res, $sourcefile, $title, $relationship);

Remarks

An ingredient is a source asset and the relationship it has to this one. Recording ingredients is what turns individual Manifests into a provenance chain: a consumer can follow an edited image back to the photograph it came from, and that one back to the camera that produced it.

SourceFile is the asset that went in. Title is a human-readable name for it; pass an empty string to omit it. Relationship is one of:

parentOfThe asset this one was derived from. An edit of a photograph names the photograph as its parent.
componentOfAn asset included in this one. A photograph placed into a composite is a component of it. This is the default when an empty string is passed.
inputToAn asset fed to a process that produced this one. A photograph used as a prompt for a generative model is an input to the result.

When the source carries a C2PA Manifest of its own, that Manifest is copied into the Manifest being written and the ingredient points at it. The chain then travels with the file: a verifier can follow it without needing the original source asset.

When the source carries no Manifest, the ingredient still records what the source was. The chain stops there, which is the truth about that asset rather than something to conceal.

Call this before Sign. Ingredients are read back through the Ingredients collection.

Example. Recording that an edited image came from a signed original:

C2PASigner signer = new C2PASigner(); signer.InputFile = "edited.jpg"; signer.OutputFile = "edited-signed.jpg"; signer.SigningCert = new Certificate(CertStoreTypes.cstPFXFile, "signer.pfx", "password", "*"); signer.ClaimGenerator = "Acme Editor/3.0"; // The photograph this edit was made from. Its Manifest travels along. signer.AddIngredient("original.jpg", "Original photograph", "parentOf"); signer.AddAction("c2pa.edited", "", "Acme Editor/3.0"); signer.Sign();

Example. Recording the sources of a generated image:

C2PASigner signer = new C2PASigner(); signer.InputFile = "generated.png"; signer.OutputFile = "generated-signed.png"; signer.SigningCert = cert; signer.ClaimGenerator = "Acme Generator/1.0"; signer.AddIngredient("reference.jpg", "Reference image", "inputTo"); // Disclose that the output is generative. signer.AddAction("c2pa.created", "http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia", "Acme Generator/1.0"); signer.Sign();

Config Method (IPWorksLLM_C2PASigner Class)

Sets or retrieves a configuration setting.

Object Oriented Interface

public function doConfig($configurationstring);

Procedural Interface

ipworksllm_c2pasigner_do_config($res, $configurationstring);

Remarks

Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, 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 (IPWorksLLM_C2PASigner Class)

This method will reset the class.

Object Oriented Interface

public function doReset();

Procedural Interface

ipworksllm_c2pasigner_do_reset($res);

Remarks

This method will reset the class's properties to their default values.

Sign Method (IPWorksLLM_C2PASigner Class)

Builds, signs, and embeds a C2PA Manifest.

Object Oriented Interface

public function doSign();

Procedural Interface

ipworksllm_c2pasigner_do_sign($res);

Remarks

This method reads the asset named by InputFile (or held in InputData), builds a C2PA Manifest from the Assertions properties, signs the claim with SigningCert, embeds the manifest into the asset, and writes the result to OutputFile (or OutputData).

The following example signs a JPEG and discloses that it was produced by a generative model.

C2PASigner signer = new C2PASigner(); signer.InputFile = "photo.jpg"; signer.OutputFile = "photo-signed.jpg"; signer.ClaimGenerator = "MyApp/1.0"; signer.SigningCert = new Certificate(CertStoreTypes.cstPFXFile, "signer.pfx", "password", "*"); signer.AddAction("c2pa.created", "http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia", "MyApp/1.0"); signer.Sign();

Signing is a two-pass operation. The manifest is embedded once at a reserved size so the final byte layout of the asset is known, the content binding hash is then computed over the asset outside the manifest's own bytes, and the real signature replaces the reservation. This is what allows the hash to cover an asset that contains the manifest.

An error is thrown when SigningCert has no private key, when SignatureAlgorithm is incompatible with that key, or when the input asset is of a format the class cannot embed into.

Error Event (IPWorksLLM_C2PASigner Class)

Fired when information is available about errors during data delivery.

Object Oriented Interface

public function fireError($param);

Procedural Interface

ipworksllm_c2pasigner_register_callback($res, 1, array($this, 'fireError'));

Parameter List

'errorcode'
'description'

Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally the class fails with an error.

The ErrorCode 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.

Log Event (IPWorksLLM_C2PASigner Class)

This event fires once for each log message.

Object Oriented Interface

public function fireLog($param);

Procedural Interface

ipworksllm_c2pasigner_register_callback($res, 2, array($this, 'fireLog'));

Parameter List

'loglevel'
'message'
'logtype'

Remarks

This event fires once for each log message generated by the class. The verbosity is controlled by the LogLevel setting.

LogLevel 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.

LogType identifies the type of log entry. Possible values are Info, Manifest, Signature, and Validation.

Config Settings (C2PASigner Class)

The class 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 class, access to these internal properties is provided through the Config method.

C2PASigner Config Settings

HashAlgorithm:   The hash algorithm used for the content binding.

This setting specifies the algorithm used to hash the asset for the content binding assertion, and to hash the assertions referenced by the claim. Possible values are sha256 (the default), sha384, and sha512.

IncludeThumbnail:   Whether a claim thumbnail is embedded in the manifest.

This setting controls whether a thumbnail of the asset is embedded in the C2PA Manifest. A thumbnail lets a consumer show what the asset looked like when it was signed, at the cost of a larger manifest. The default value is False.

InstanceId:   The instance identifier recorded in the claim.

This setting specifies the instance identifier written into the claim, which uniquely identifies this particular version of the asset. When it is left empty, the class generates one. It must be set before calling Sign.

LogLevel:   The level of detail logged through the Log event.

This setting controls the verbosity of the Log event. Possible values are 0 (None), 1 (Info, the default), 2 (Verbose), and 3 (Debug).

SignaturePadding:   The number of bytes reserved for the claim signature.

This setting specifies how much room is set aside for the signature while the manifest is being assembled.

Signing happens in two passes: the manifest is written once at a fixed size to establish the byte offsets the content binding needs, then rewritten with the real signature in the space reserved for it. If the signature does not fit, the whole operation repeats with a larger reservation, which costs time.

The default is 25600 bytes, the size the C2PA specification recommends. Lower it when the signing certificate chain is small and manifest size matters; raise it when signing with a long chain, to avoid the retry.

Base Config Settings

BuildInfo:   Information about the product's build.

When queried, this setting will return a string containing information about the product's build.

CodePage:   The system code page used for Unicode to Multibyte translations.

The default code page is Unicode UTF-8 (65001).

The following is a list of valid code page identifiers:

IdentifierName
037IBM EBCDIC - U.S./Canada
437OEM - United States
500IBM EBCDIC - International
708Arabic - ASMO 708
709Arabic - ASMO 449+, BCON V4
710Arabic - Transparent Arabic
720Arabic - Transparent ASMO
737OEM - Greek (formerly 437G)
775OEM - Baltic
850OEM - Multilingual Latin I
852OEM - Latin II
855OEM - Cyrillic (primarily Russian)
857OEM - Turkish
858OEM - Multilingual Latin I + Euro symbol
860OEM - Portuguese
861OEM - Icelandic
862OEM - Hebrew
863OEM - Canadian-French
864OEM - Arabic
865OEM - Nordic
866OEM - Russian
869OEM - Modern Greek
870IBM EBCDIC - Multilingual/ROECE (Latin-2)
874ANSI/OEM - Thai (same as 28605, ISO 8859-15)
875IBM EBCDIC - Modern Greek
932ANSI/OEM - Japanese, Shift-JIS
936ANSI/OEM - Simplified Chinese (PRC, Singapore)
949ANSI/OEM - Korean (Unified Hangul Code)
950ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC)
1026IBM EBCDIC - Turkish (Latin-5)
1047IBM EBCDIC - Latin 1/Open System
1140IBM EBCDIC - U.S./Canada (037 + Euro symbol)
1141IBM EBCDIC - Germany (20273 + Euro symbol)
1142IBM EBCDIC - Denmark/Norway (20277 + Euro symbol)
1143IBM EBCDIC - Finland/Sweden (20278 + Euro symbol)
1144IBM EBCDIC - Italy (20280 + Euro symbol)
1145IBM EBCDIC - Latin America/Spain (20284 + Euro symbol)
1146IBM EBCDIC - United Kingdom (20285 + Euro symbol)
1147IBM EBCDIC - France (20297 + Euro symbol)
1148IBM EBCDIC - International (500 + Euro symbol)
1149IBM EBCDIC - Icelandic (20871 + Euro symbol)
1200Unicode UCS-2 Little-Endian (BMP of ISO 10646)
1201Unicode UCS-2 Big-Endian
1250ANSI - Central European
1251ANSI - Cyrillic
1252ANSI - Latin I
1253ANSI - Greek
1254ANSI - Turkish
1255ANSI - Hebrew
1256ANSI - Arabic
1257ANSI - Baltic
1258ANSI/OEM - Vietnamese
1361Korean (Johab)
10000MAC - Roman
10001MAC - Japanese
10002MAC - Traditional Chinese (Big5)
10003MAC - Korean
10004MAC - Arabic
10005MAC - Hebrew
10006MAC - Greek I
10007MAC - Cyrillic
10008MAC - Simplified Chinese (GB 2312)
10010MAC - Romania
10017MAC - Ukraine
10021MAC - Thai
10029MAC - Latin II
10079MAC - Icelandic
10081MAC - Turkish
10082MAC - Croatia
12000Unicode UCS-4 Little-Endian
12001Unicode UCS-4 Big-Endian
20000CNS - Taiwan
20001TCA - Taiwan
20002Eten - Taiwan
20003IBM5550 - Taiwan
20004TeleText - Taiwan
20005Wang - Taiwan
20105IA5 IRV International Alphabet No. 5 (7-bit)
20106IA5 German (7-bit)
20107IA5 Swedish (7-bit)
20108IA5 Norwegian (7-bit)
20127US-ASCII (7-bit)
20261T.61
20269ISO 6937 Non-Spacing Accent
20273IBM EBCDIC - Germany
20277IBM EBCDIC - Denmark/Norway
20278IBM EBCDIC - Finland/Sweden
20280IBM EBCDIC - Italy
20284IBM EBCDIC - Latin America/Spain
20285IBM EBCDIC - United Kingdom
20290IBM EBCDIC - Japanese Katakana Extended
20297IBM EBCDIC - France
20420IBM EBCDIC - Arabic
20423IBM EBCDIC - Greek
20424IBM EBCDIC - Hebrew
20833IBM EBCDIC - Korean Extended
20838IBM EBCDIC - Thai
20866Russian - KOI8-R
20871IBM EBCDIC - Icelandic
20880IBM EBCDIC - Cyrillic (Russian)
20905IBM EBCDIC - Turkish
20924IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol)
20932JIS X 0208-1990 & 0121-1990
20936Simplified Chinese (GB2312)
21025IBM EBCDIC - Cyrillic (Serbian, Bulgarian)
21027Extended Alpha Lowercase
21866Ukrainian (KOI8-U)
28591ISO 8859-1 Latin I
28592ISO 8859-2 Central Europe
28593ISO 8859-3 Latin 3
28594ISO 8859-4 Baltic
28595ISO 8859-5 Cyrillic
28596ISO 8859-6 Arabic
28597ISO 8859-7 Greek
28598ISO 8859-8 Hebrew
28599ISO 8859-9 Latin 5
28605ISO 8859-15 Latin 9
29001Europa 3
38598ISO 8859-8 Hebrew
50220ISO 2022 Japanese with no halfwidth Katakana
50221ISO 2022 Japanese with halfwidth Katakana
50222ISO 2022 Japanese JIS X 0201-1989
50225ISO 2022 Korean
50227ISO 2022 Simplified Chinese
50229ISO 2022 Traditional Chinese
50930Japanese (Katakana) Extended
50931US/Canada and Japanese
50933Korean Extended and Korean
50935Simplified Chinese Extended and Simplified Chinese
50936Simplified Chinese
50937US/Canada and Traditional Chinese
50939Japanese (Latin) Extended and Japanese
51932EUC - Japanese
51936EUC - Simplified Chinese
51949EUC - Korean
51950EUC - Traditional Chinese
52936HZ-GB2312 Simplified Chinese
54936Windows XP: GB18030 Simplified Chinese (4 Byte)
57002ISCII Devanagari
57003ISCII Bengali
57004ISCII Tamil
57005ISCII Telugu
57006ISCII Assamese
57007ISCII Oriya
57008ISCII Kannada
57009ISCII Malayalam
57010ISCII Gujarati
57011ISCII Punjabi
65000Unicode UTF-7
65001Unicode UTF-8
The following is a list of valid code page identifiers for Mac OS only:
IdentifierName
1ASCII
2NEXTSTEP
3JapaneseEUC
4UTF8
5ISOLatin1
6Symbol
7NonLossyASCII
8ShiftJIS
9ISOLatin2
10Unicode
11WindowsCP1251
12WindowsCP1252
13WindowsCP1253
14WindowsCP1254
15WindowsCP1250
21ISO2022JP
30MacOSRoman
10UTF16String
0x90000100UTF16BigEndian
0x94000100UTF16LittleEndian
0x8c000100UTF32String
0x98000100UTF32BigEndian
0x9c000100UTF32LittleEndian
65536Proprietary

LicenseInfo:   Information about the current license.

When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:

  • 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.
MaskSensitiveData:   Whether sensitive data is masked in log messages.

In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to true to mask sensitive data. The default is true.

UseInternalSecurityAPI:   Whether or not to use the system security libraries or an internal implementation.

When set to false, the class will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this configuration setting to true tells the class 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 (C2PASigner Class)

C2PASigner Errors

101    Unsupported algorithm. See SignatureAlgorithm for the permitted signature algorithms, and the HashAlgorithm configuration setting for the permitted hash algorithms.
102    The signing certificate is missing or has no associated private key.
103    Unsupported asset format. The asset is not one of the formats the class can embed a C2PA Manifest into.
105    The claim signature could not be fitted into the reserved space. Raise the SignaturePadding configuration setting; the usual cause is an unusually large certificate chain.
106    A required parameter is missing or invalid.
107    The Manifest could not be laid out. This indicates a defect in the class rather than a problem with the input.
108    The Time Stamping Authority named by TSAURL did not return a time-stamp token. The Manifest is not written, so that a signature is never produced without the time-stamp that was asked for.
109    The output file already exists and Overwrite is False.
304    Cannot write file.
305    Cannot read file.