c2pa-c
C++ API for c2pa-c library
Loading...
Searching...
No Matches
c2pa Namespace Reference

Classes

class  Builder
 Builder class for creating a manifest. More...
 
class  C2paException
 
class  CppIOStream
 IOStream Class wrapper for C2paStream. More...
 
class  CppIStream
 Istream Class wrapper for C2paStream. More...
 
class  CppOStream
 Ostream Class wrapper for C2paStream. More...
 
class  Reader
 Reader class for reading a manifest. More...
 
class  Signer
 Signer class for creating a signer. More...
 

Typedefs

typedef C2paSignerInfo SignerInfo
 
using SignerFunc = std::vector< unsigned char >(const std::vector< unsigned char > &)
 Signer Callback function type.
 

Functions

string version ()
 Returns the version of the C2pa library.
 
void load_settings (const string &data, const string &format)
 
optional< string > read_file (const filesystem::path &source_path, const optional< path > data_dir=nullopt)
 
std::string read_ingredient_file (const path &source_path, const path &data_dir)
 
void sign_file (const path &source_path, const path &dest_path, const char *manifest, SignerInfo *signer_info, const std::optional< path > data_dir=std::nullopt)
 

Typedef Documentation

◆ SignerFunc

using c2pa::SignerFunc = typedef std::vector<unsigned char>(const std::vector<unsigned char> &)

Signer Callback function type.

Parameters
datathe data to sign.
Returns
the signature as a vector of bytes.

This function type is used to create a callback function for signing.

◆ SignerInfo

typedef C2paSignerInfo c2pa::SignerInfo

Function Documentation

◆ load_settings()

void c2pa::load_settings ( const string &  data,
const string &  format 
)

Loads C2PA settings from a string in a given format.

Parameters
datathe string to load.
formatthe mime format of the string.
Exceptions
aC2pa::C2paException for errors encountered by the C2PA library.

◆ read_file()

optional< string > c2pa::read_file ( const filesystem::path &  source_path,
const optional< path data_dir = nullopt 
)

Reads a file and returns the manifest json as a C2pa::String.

Parameters
source_paththe path to the file to read.
data_dirthe directory to store binary resources (optional).
Returns
a string containing the manifest json if a manifest was found.
Exceptions
aC2pa::C2paException for errors encountered by the C2PA library.

◆ read_ingredient_file()

std::string c2pa::read_ingredient_file ( const path source_path,
const path data_dir 
)

Reads a file and returns an ingredient JSON as a C2pa::String.

Parameters
source_paththe path to the file to read.
data_dirthe directory to store binary resources.
Returns
a string containing the ingredient json.
Exceptions
aC2pa::C2paException for errors encountered by the C2PA library.

◆ sign_file()

void c2pa::sign_file ( const path source_path,
const path dest_path,
const char *  manifest,
SignerInfo signer_info,
const std::optional< path data_dir = std::nullopt 
)

Adds the manifest and signs a file.

Parameters
source_paththe path to the asset to be signed.
dest_paththe path to write the signed file to.
manifestthe manifest json to add to the file.
signer_infothe signer info to use for signing.
data_dirthe directory to store binary resources (optional).
Exceptions
aC2pa::C2paException for errors encountered by the C2PA library.

◆ version()

string c2pa::version ( )

Returns the version of the C2pa library.