summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2023-03-20 20:16:53 -0400
committerGitHub <noreply@github.com>2023-03-21 08:16:53 +0800
commitf371af837a6785959e52ac4c84e80f0453c542f1 (patch)
tree087b340b6ffe83aceb5e56c78af85ed8c53513a5 /tests
parent328f04dd8a575540ef493613c08f3a521365ce8f (diff)
downloadcryptography-f371af837a6785959e52ac4c84e80f0453c542f1.tar.gz
Added support for handling python buffers in Rust code (#8556)
This is extra mega cursed, and strictly speaking unsound. It does, however, match the status quo ante, where someone mutating a buffer while its being used in cffi code will basically always be UB.
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_pkcs7.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_pkcs7.py b/tests/hazmat/primitives/test_pkcs7.py
index 88de12ff5..4e61c5ef5 100644
--- a/tests/hazmat/primitives/test_pkcs7.py
+++ b/tests/hazmat/primitives/test_pkcs7.py
@@ -334,6 +334,31 @@ class TestPKCS7Builder:
sig = builder.sign(serialization.Encoding.SMIME, options)
assert bytes(data) in sig
+ _pkcs7_verify(
+ serialization.Encoding.SMIME,
+ sig,
+ data,
+ [cert],
+ options,
+ backend,
+ )
+
+ data = bytearray(b"")
+ builder = (
+ pkcs7.PKCS7SignatureBuilder()
+ .set_data(data)
+ .add_signer(cert, key, hashes.SHA256())
+ )
+
+ sig = builder.sign(serialization.Encoding.SMIME, options)
+ _pkcs7_verify(
+ serialization.Encoding.SMIME,
+ sig,
+ data,
+ [cert],
+ options,
+ backend,
+ )
def test_sign_pem(self, backend):
data = b"hello world"