Skip to content

Commit 1c7f17c

Browse files
authored
feat(native): certificates extension pack with zero-copy API adaptation (#187)
Phase 4: certificates and certificates_local extension packs with zero-copy architecture. 4 crates added, C/C++ projections, dynamic FFI discovery, A+ quality verified.
1 parent 2c5149b commit 1c7f17c

129 files changed

Lines changed: 30324 additions & 29 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dotnet.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,29 @@ jobs:
155155

156156
- name: Rust format check
157157
shell: pwsh
158+
working-directory: native/rust
158159
run: |
159-
cargo fmt --manifest-path native/rust/Cargo.toml --all -- --check
160+
# Per-package to avoid Windows OS error 206 (command line too long)
161+
$members = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages.name
162+
foreach ($pkg in $members) {
163+
cargo fmt -p $pkg -- --check
164+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
165+
}
166+
# FFI crates with test=false exclude test files from cargo fmt.
167+
# Check them directly with rustfmt.
168+
Get-ChildItem -Path . -Filter '*.rs' -Recurse |
169+
Where-Object { $_.FullName -match 'ffi[\\/]tests[\\/]' } |
170+
ForEach-Object {
171+
rustfmt --check $_.FullName
172+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
173+
}
160174
161175
- name: Rust clippy
162176
shell: pwsh
177+
working-directory: native/rust
163178
run: |
164179
$env:PATH = "$env:VCPKG_ROOT\installed\x64-windows\bin;$env:PATH"
165-
cargo clippy --manifest-path native/rust/Cargo.toml --workspace -- -D warnings
180+
cargo clippy --workspace -- -D warnings
166181
167182
- name: Setup Rust (nightly, for coverage)
168183
uses: dtolnay/rust-toolchain@nightly
@@ -186,23 +201,24 @@ jobs:
186201
187202
- name: Build Rust workspace
188203
shell: pwsh
204+
working-directory: native/rust
189205
run: |
190206
$env:PATH = "$env:VCPKG_ROOT\installed\x64-windows\bin;$env:PATH"
191-
cargo build --manifest-path native/rust/Cargo.toml --workspace --exclude cose-openssl
207+
cargo build --workspace --exclude cose-openssl
192208
193209
- name: Test Rust workspace
194210
shell: pwsh
211+
working-directory: native/rust
195212
run: |
196213
$env:PATH = "$env:VCPKG_ROOT\installed\x64-windows\bin;$env:PATH"
197-
cargo test --manifest-path native/rust/Cargo.toml --workspace --exclude cose-openssl
214+
cargo test --workspace --exclude cose-openssl
198215
199216
- name: Rust coverage (90% line gate)
200217
shell: pwsh
218+
working-directory: native/rust
201219
run: |
202220
$env:PATH = "$env:VCPKG_ROOT\installed\x64-windows\bin;$env:PATH"
203-
Push-Location native/rust
204221
pwsh -NoProfile -File collect-coverage.ps1 -NoHtml
205-
Pop-Location
206222
207223
# ── Native C/C++: build, test, coverage (ASAN) ────────────────────
208224
native-c-cpp:

native/c/include/cose/crypto/openssl.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ cose_status_t cose_crypto_openssl_signer_from_der(
9595
cose_crypto_signer_t** out_signer
9696
);
9797

98+
/**
99+
* @brief Creates a signer from a PEM-encoded private key
100+
*
101+
* @param provider Provider handle
102+
* @param private_key_pem Pointer to PEM-encoded private key bytes
103+
* @param len Length of private key data in bytes
104+
* @param out_signer Output pointer to receive the signer handle
105+
* @return COSE_OK on success, error code otherwise
106+
*/
107+
cose_status_t cose_crypto_openssl_signer_from_pem(
108+
const cose_crypto_provider_t* provider,
109+
const uint8_t* private_key_pem,
110+
size_t len,
111+
cose_crypto_signer_t** out_signer
112+
);
113+
98114
/**
99115
* @brief Sign data using the given signer
100116
*
@@ -148,6 +164,22 @@ cose_status_t cose_crypto_openssl_verifier_from_der(
148164
cose_crypto_verifier_t** out_verifier
149165
);
150166

167+
/**
168+
* @brief Creates a verifier from a PEM-encoded public key
169+
*
170+
* @param provider Provider handle
171+
* @param public_key_pem Pointer to PEM-encoded public key bytes
172+
* @param len Length of public key data in bytes
173+
* @param out_verifier Output pointer to receive the verifier handle
174+
* @return COSE_OK on success, error code otherwise
175+
*/
176+
cose_status_t cose_crypto_openssl_verifier_from_pem(
177+
const cose_crypto_provider_t* provider,
178+
const uint8_t* public_key_pem,
179+
size_t len,
180+
cose_crypto_verifier_t** out_verifier
181+
);
182+
151183
/**
152184
* @brief Verify a signature using the given verifier
153185
*

0 commit comments

Comments
 (0)