Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ crate-type = ["lib", "cdylib"]
normal = ["openssl-src"]

[dependencies]
c2pa = { version = "0.41.1", features = ["unstable_api", "file_io", "openssl", "pdf", "fetch_remote_manifests"]}
c2pa-crypto = {version = "0.3.1" }
c2pa = { version = "0.42.0", features = ["unstable_api", "file_io", "openssl", "pdf", "fetch_remote_manifests"]}
thiserror = "1.0.49"
uniffi = "0.28.2"
openssl-src = "=300.3.1" # Required for openssl-sys
Expand Down
41 changes: 0 additions & 41 deletions src/callback_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// each license.

use c2pa::{Signer, SigningAlg};
// RawSigner is currently used only fully qualified
use c2pa_crypto::{raw_signature::RawSignerError, time_stamp::TimeStampProvider};
use log::debug;

use crate::Result;
Expand All @@ -36,41 +34,6 @@ pub struct RemoteSigner {
reserve_size: u32,
}

impl TimeStampProvider for RemoteSigner {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh so much better!


impl c2pa_crypto::raw_signature::RawSigner for RemoteSigner {
fn sign(&self, data: &[u8]) -> std::result::Result<Vec<u8>, RawSignerError> {
let signature_result = self.signer_callback.sign(data.to_vec());

match signature_result {
Ok(signature) => Ok(signature),
Err(e) => Err(c2pa_crypto::raw_signature::RawSignerError::IoError(
e.to_string(),
)),
}
}

fn alg(&self) -> c2pa_crypto::raw_signature::SigningAlg {
match self.alg {
SigningAlg::Es384 => c2pa_crypto::raw_signature::SigningAlg::Es384,
SigningAlg::Es512 => c2pa_crypto::raw_signature::SigningAlg::Es512,
SigningAlg::Ps256 => c2pa_crypto::raw_signature::SigningAlg::Ps256,
SigningAlg::Ps384 => c2pa_crypto::raw_signature::SigningAlg::Ps384,
SigningAlg::Ps512 => c2pa_crypto::raw_signature::SigningAlg::Ps512,
SigningAlg::Ed25519 => c2pa_crypto::raw_signature::SigningAlg::Ed25519,
SigningAlg::Es256 => c2pa_crypto::raw_signature::SigningAlg::Es256,
}
}

fn cert_chain(&self) -> std::result::Result<Vec<Vec<u8>>, RawSignerError> {
Ok(Vec::new())
}

fn reserve_size(&self) -> usize {
self.reserve_size as usize
}
}

impl Signer for RemoteSigner {
fn sign(&self, data: &[u8]) -> c2pa::Result<Vec<u8>> {
self.signer_callback
Expand All @@ -94,10 +57,6 @@ impl Signer for RemoteSigner {
fn direct_cose_handling(&self) -> bool {
true
}

fn raw_signer(&self) -> Box<&dyn c2pa_crypto::raw_signature::RawSigner> {
Box::new(self)
}
}

impl CallbackSigner {
Expand Down
1 change: 1 addition & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def getitem(d, key):
]
}

# ingredient we will use for testing
ingredient_def = {
"relationship": "parentOf",
"thumbnail": {
Expand Down
Loading