-
Notifications
You must be signed in to change notification settings - Fork 0
feat(xmldsig): compute signing reference digests #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ rsa = { version = "0.10.0-rc.18", optional = true } | |
| sha1 = { version = "0.11", features = ["oid"], optional = true } | ||
| sha2 = { version = "0.11", features = ["oid"], optional = true } | ||
| p256 = { version = "0.14", features = ["ecdsa"], optional = true } | ||
| p384 = { version = "0.14.0-rc.15", features = ["ecdsa"], optional = true } | ||
| p384 = { version = "0.14", features = ["ecdsa"], optional = true } | ||
| p521 = { version = "0.14.0-rc.15", features = ["ecdsa"], optional = true } | ||
| signature = { version = "3", optional = true } | ||
| subtle = { version = "2", optional = true } | ||
|
|
@@ -31,6 +31,7 @@ subtle = { version = "2", optional = true } | |
| x509-parser = { version = "0.18", features = ["verify"], optional = true } | ||
| der = { version = "0.8", optional = true } | ||
| crypto-bigint = { version = "0.7", optional = true } | ||
| crypto-common = { version = "0.2", optional = true } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify the manifest enables crypto-common's getrandom feature when SysRng is imported.
rg -n 'crypto_common::getrandom::SysRng|crypto-common|getrandom' src Cargo.tomlRepository: structured-world/xml-sec Length of output: 328 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== Cargo.toml ==\n'
cat -n Cargo.toml | sed -n '1,120p'
printf '\n== src/xmldsig/sign.rs ==\n'
cat -n src/xmldsig/sign.rs | sed -n '1,220p'Repository: structured-world/xml-sec Length of output: 11911 🌐 Web query:
💡 Result: In the crypto-common crate (specifically version 0.2 and later), the getrandom feature enables the usage of the getrandom crate, specifically leveraging its SysRng type [1][2]. This integration replaced older, vendored random number generator implementations within crypto-common [2]. The SysRng type, introduced in getrandom v0.4, acts as the system's preferred random number source, providing a cross-platform interface for retrieving cryptographically secure random data [3]. Within the Cargo.toml of crypto-common 0.2.x, this is configured as an optional dependency: getrandom = { version = "0.4", optional = true, features = ["sys_rng"] } And defined in the [features] section: getrandom = ["rand_core", "dep:getrandom"] When the getrandom feature is enabled in your project, it allows cryptographic traits within crypto-common to utilize SysRng for operations requiring entropy, such as key generation [2][4]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect any Cargo.lock entry and feature wiring for crypto-common.
rg -n '^name = "crypto-common"|^version = |getrandom|SysRng' Cargo.lock Cargo.toml src -nRepository: structured-world/xml-sec Length of output: 3367 🌐 Web query:
💡 Result: In the crypto-common crate version 0.2, the getrandom feature enables integration with the getrandom crate, providing access to the system's ambient cryptographically secure random number generator [1][2]. Key details regarding this feature include: Integration: When the getrandom feature is enabled, the crypto-common crate re-exports the getrandom crate [3]. This allows developers to utilize system-provided randomness directly within cryptographic workflows [2]. Functionality: Enabling this feature grants access to the Generate trait's ambient generation methods, specifically try_generate and generate [2]. These methods allow types that implement Generate to be randomly initialized using the system's preferred entropy source without requiring the user to manually pass a random number generator (RNG) instance [2]. Usage Note: The generate method will panic if the system's ambient RNG experiences an internal failure, whereas try_generate returns a Result to handle such errors gracefully [2]. The SysRng mentioned in your query refers to the interface provided by the getrandom crate (which crypto-common facilitates) to interact with the system's primary random source [4]. As of version 0.2, usage of these features is the recommended approach for secure random generation, replacing older, now-deprecated methods that relied solely on passing an explicit CryptoRng [5][6]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== crypto-common lock entries ==\n'
awk '
$0 ~ /^name = "crypto-common"$/ {show=1; start=NR-2}
show {print NR ":" $0}
show && $0 == "" {count++; if (count >= 2) exit}
' Cargo.lock
printf '\n== surrounding packages that depend on crypto-common ==\n'
python3 - <<'PY'
from pathlib import Path
text = Path("Cargo.lock").read_text().splitlines()
for i, line in enumerate(text):
if line.strip() == 'name = "crypto-common"':
for j in range(max(0, i-5), min(len(text), i+30)):
print(f"{j+1}:{text[j]}")
print("----")
PYRepository: structured-world/xml-sec Length of output: 1717 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== manifest features around xmldsig ==\n'
sed -n '46,62p' Cargo.toml
printf '\n== references to crypto-common feature names in repository ==\n'
rg -n 'crypto-common.*getrandom|getrandom.*crypto-common|feature.*getrandom|SysRng' .Repository: structured-world/xml-sec Length of output: 805 Enable 🤖 Prompt for AI Agents |
||
|
|
||
| # Base64 encoding/decoding | ||
| base64 = "0.22" | ||
|
|
@@ -47,6 +48,7 @@ default = ["xmldsig", "c14n"] | |
| xmldsig = [ # XML Digital Signatures (sign + verify) | ||
| "dep:der", | ||
| "dep:crypto-bigint", | ||
| "dep:crypto-common", | ||
| "dep:p256", | ||
| "dep:p384", | ||
| "dep:p521", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.