Skip to content

Commit 0d954c8

Browse files
committed
WIP
1 parent 5b52d70 commit 0d954c8

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["lib", "cdylib"]
1212
normal = ["openssl-src"]
1313

1414
[dependencies]
15-
c2pa = { git = "https://github.com/contentauth/c2pa-rs.git", branch="mathern/python-tradeoffs", features = ["unstable_api", "file_io", "openssl", "pdf", "fetch_remote_manifests"]}
15+
c2pa = { version = "0.41.0", features = ["unstable_api", "file_io", "openssl", "pdf", "fetch_remote_manifests"]}
1616
c2pa-crypto = {version = "0.3.0" }
1717
thiserror = "1.0.49"
1818
uniffi = "0.28.2"

src/callback_signer.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
use c2pa::{Signer, SigningAlg};
1414
use c2pa_crypto::{
15-
raw_signature::{RawSigner, RawSignerError},
16-
time_stamp::TimeStampProvider,
15+
raw_signature::{RawSigner, RawSignerError},
16+
time_stamp::TimeStampProvider,
1717
};
1818
use log::debug;
1919

@@ -38,13 +38,16 @@ pub struct RemoteSigner {
3838
reserve_size: u32,
3939
}
4040

41+
pub struct RawRemoteSigner {
42+
signer_callback: Box<dyn SignerCallback>,
43+
alg: SigningAlg,
44+
reserve_size: u32,
45+
}
46+
4147
impl TimeStampProvider for RemoteSigner {}
4248

4349
impl c2pa_crypto::raw_signature::RawSigner for RemoteSigner {
44-
fn sign(
45-
&self,
46-
data: &[u8],
47-
) -> std::result::Result<Vec<u8>, RawSignerError> {
50+
fn sign(&self, data: &[u8]) -> std::result::Result<Vec<u8>, RawSignerError> {
4851
let signature_result = self.signer_callback.sign(data.to_vec());
4952

5053
match signature_result {
@@ -64,12 +67,11 @@ impl c2pa_crypto::raw_signature::RawSigner for RemoteSigner {
6467
SigningAlg::Ps384 => c2pa_crypto::raw_signature::SigningAlg::Ps384,
6568
SigningAlg::Ps512 => c2pa_crypto::raw_signature::SigningAlg::Ps512,
6669
SigningAlg::Ed25519 => c2pa_crypto::raw_signature::SigningAlg::Ed25519,
70+
_ => c2pa_crypto::raw_signature::SigningAlg::Es256,
6771
}
6872
}
6973

70-
fn cert_chain(
71-
&self,
72-
) -> std::result::Result<Vec<Vec<u8>>, RawSignerError> {
74+
fn cert_chain(&self) -> std::result::Result<Vec<Vec<u8>>, RawSignerError> {
7375
Ok(Vec::new())
7476
}
7577

@@ -102,8 +104,8 @@ impl Signer for RemoteSigner {
102104
true
103105
}
104106

105-
fn raw_signer(&self) -> Box<&dyn RawSigner> {
106-
todo!()
107+
fn raw_signer(&self) -> Box<&dyn c2pa_crypto::raw_signature::RawSigner> {
108+
Box::new(self)
107109
}
108110
}
109111

0 commit comments

Comments
 (0)