Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ target/
.rust-cov/
*.lcov
*.profdata
venv
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
1 change: 1 addition & 0 deletions src/cryptography/hazmat/primitives/serialization/pkcs7.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PKCS7Options(utils.Enum):
NoCapabilities = "Don't embed SMIME capabilities"
NoAttributes = "Don't embed authenticatedAttributes"
NoCerts = "Don't embed signer certificate"
NoVerify = "Don't verify the signers certificate of a signed message"


class PKCS7SignatureBuilder:
Expand Down
3 changes: 3 additions & 0 deletions src/rust/src/test_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ fn pkcs7_verify(
if options.contains(types::PKCS7_TEXT.get(py)?)? {
flags |= openssl::pkcs7::Pkcs7Flags::TEXT;
}
if options.contains(types::PKCS7_NO_VERIFY.get(py)?)? {
flags |= openssl::pkcs7::Pkcs7Flags::NOVERIFY;
}

let store = {
let mut b = openssl::x509::store::X509StoreBuilder::new()?;
Expand Down
6 changes: 6 additions & 0 deletions src/rust/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ pub static PKCS7_DETACHED_SIGNATURE: LazyPyImport = LazyPyImport::new(
&["PKCS7Options", "DetachedSignature"],
);

#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
pub static PKCS7_NO_VERIFY: LazyPyImport = LazyPyImport::new(
"cryptography.hazmat.primitives.serialization.pkcs7",
&["PKCS7Options", "NoVerify"],
);

pub static SMIME_ENVELOPED_ENCODE: LazyPyImport = LazyPyImport::new(
"cryptography.hazmat.primitives.serialization.pkcs7",
&["_smime_enveloped_encode"],
Expand Down
Loading