|
c2pa-c
C++ API for c2pa-c library
|
Namespaces | |
| namespace | detail |
Classes | |
| class | Builder |
| Builder class for creating a manifest. More... | |
| class | C2paException |
| Exception class for C2pa errors. This class is used to throw exceptions for errors encountered by the C2pa library via c2pa_error(). More... | |
| class | Context |
| C2PA context implementing IContextProvider. More... | |
| class | CppIOStream |
| IOStream Class wrapper for C2paStream. More... | |
| class | CppIStream |
| Input stream IStream wrapper for C2paStream. More... | |
| class | CppOStream |
| Output stream OStream wrapper for C2paStream. More... | |
| class | IContextProvider |
| Interface for types that can provide C2PA context functionality. More... | |
| class | Reader |
| Reader class for reading a manifest. More... | |
| class | Settings |
| (C2PA SDK) Settings configuration object for creating contexts. More... | |
| class | Signer |
| Signer class for creating a Signer. More... | |
Typedefs | |
| typedef C2paSignerInfo | SignerInfo |
| Type alias for C2paSignerInfo from the C API. | |
| using | SignerFunc = std::vector< unsigned char >(const std::vector< unsigned char > &) |
| Signer callback function type. | |
Enumerations | |
| enum class | OperationResult : int { Success = 0 , Error = -1 } |
| Result codes for C API operations (matches C API return convention). More... | |
| enum class | StreamError : int { InvalidArgument = EINVAL , IoError = EIO , NoBufferSpace = ENOBUFS } |
| Stream/FFI error codes (maps to errno values used by the C layer). More... | |
Functions | |
| int | stream_error_return (StreamError e) noexcept |
| Set errno from StreamError and return error sentinel. | |
| std::string | version () |
| Get the version of the C2PA library. | |
| void | load_settings (const std::string &data, const std::string &format) |
| Load C2PA settings from a string in a given format. | |
| std::optional< std::string > | read_file (const std::filesystem::path &source_path, const std::optional< std::filesystem::path > data_dir=std::nullopt) |
| Read a file and return the manifest JSON. | |
| std::string | read_ingredient_file (const std::filesystem::path &source_path, const std::filesystem::path &data_dir) |
| Read a file and return an ingredient JSON. | |
| void | sign_file (const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const char *manifest, SignerInfo *signer_info, const std::optional< std::filesystem::path > data_dir=std::nullopt) |
| Add a manifest and sign a file. | |
| using c2pa::SignerFunc = typedef std::vector<unsigned char>(const std::vector<unsigned char> &) |
Signer callback function type.
This function type is used to create a callback function for signing. The callback receives data to sign and returns the signature.
| data | The data to sign. |
Type alias for C2paSignerInfo from the C API.
|
strong |
Result codes for C API operations (matches C API return convention).
| Enumerator | |
|---|---|
| Success | Operation succeeded. |
| Error | Operation failed (check C2paException for details) |
|
strong |
Stream/FFI error codes (maps to errno values used by the C layer).
| Enumerator | |
|---|---|
| InvalidArgument | |
| IoError | |
| NoBufferSpace | |
| void c2pa::load_settings | ( | const std::string & | data, |
| const std::string & | format | ||
| ) |
Load C2PA settings from a string in a given format.
| data | The configuration data to load. |
| format | The mimetype of the string. |
| C2paException | for errors encountered by the C2PA library. |
| std::optional< std::string > c2pa::read_file | ( | const std::filesystem::path & | source_path, |
| const std::optional< std::filesystem::path > | data_dir = std::nullopt |
||
| ) |
Read a file and return the manifest JSON.
| source_path | The path to the file to read. |
| data_dir | Optional directory to store binary resources. |
| C2paException | for errors encountered by the C2PA library. |
| std::string c2pa::read_ingredient_file | ( | const std::filesystem::path & | source_path, |
| const std::filesystem::path & | data_dir | ||
| ) |
Read a file and return an ingredient JSON.
| source_path | The path to the file to read. |
| data_dir | The directory to store binary resources. |
| C2paException | for errors encountered by the C2PA library. |
| void c2pa::sign_file | ( | const std::filesystem::path & | source_path, |
| const std::filesystem::path & | dest_path, | ||
| const char * | manifest, | ||
| SignerInfo * | signer_info, | ||
| const std::optional< std::filesystem::path > | data_dir = std::nullopt |
||
| ) |
Add a manifest and sign a file.
| source_path | The path to the asset to be signed. |
| dest_path | The path to write the signed file to. |
| manifest | The manifest JSON to add to the file. |
| signer_info | The signer info to use for signing. |
| data_dir | Optional directory to store binary resources. |
| C2paException | for errors encountered by the C2PA library. |
|
inlinenoexcept |
Set errno from StreamError and return error sentinel.
| e | The StreamError value to convert to errno. |
| std::string c2pa::version | ( | ) |
Get the version of the C2PA library.