mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Added new test cases for PKCS#8 parsing (#12305)
This commit is contained in:
parent
66fbfb2242
commit
86b24873c7
4 changed files with 23 additions and 0 deletions
|
|
@ -189,6 +189,10 @@ Custom asymmetric vectors
|
|||
``TEST(DSATest, NilpotentGenerator)``).
|
||||
* ``asymmetric/PKCS8/ec-invalid-private-scalar.pem`` - Contains a PKCS8 encoded
|
||||
PEM with a ``secp256r1`` OID and an invalid (very large) private scalar.
|
||||
* ``asymmetric/PKCS8/invalid-version.der`` - Contains a PKCS8 encoded DER with
|
||||
an invalid version field.
|
||||
* ``asymmetric/PKCS8/unknown-oid.der`` - Contains a PKCS8 encoded DER with an
|
||||
unknown OID.
|
||||
|
||||
|
||||
Key exchange
|
||||
|
|
|
|||
|
|
@ -405,6 +405,25 @@ class TestDERSerialization:
|
|||
with pytest.raises(ValueError):
|
||||
load_der_parameters(param_data, backend)
|
||||
|
||||
@pytest.mark.xfail()
|
||||
def test_load_pkcs8_private_key_invalid_version(self):
|
||||
data = load_vectors_from_file(
|
||||
os.path.join("asymmetric", "PKCS8", "invalid-version.der"),
|
||||
lambda f: f.read(),
|
||||
mode="rb",
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
load_der_private_key(data, password=None)
|
||||
|
||||
def test_load_pkcs8_private_key_unknown_oid(self):
|
||||
data = load_vectors_from_file(
|
||||
os.path.join("asymmetric", "PKCS8", "unknown-oid.der"),
|
||||
lambda f: f.read(),
|
||||
mode="rb",
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
load_der_private_key(data, password=None)
|
||||
|
||||
|
||||
class TestPEMSerialization:
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Binary file not shown.
BIN
vectors/cryptography_vectors/asymmetric/PKCS8/unknown-oid.der
Normal file
BIN
vectors/cryptography_vectors/asymmetric/PKCS8/unknown-oid.der
Normal file
Binary file not shown.
Loading…
Reference in a new issue