Skip to content

test: skip TraditionalOpenSSL PEM assertions in FIPS mode - #700

Open
stewartsmith wants to merge 1 commit into
tpm2-software:masterfrom
stewartsmith:fips-mode
Open

test: skip TraditionalOpenSSL PEM assertions in FIPS mode#700
stewartsmith wants to merge 1 commit into
tpm2-software:masterfrom
stewartsmith:fips-mode

Conversation

@stewartsmith

Copy link
Copy Markdown

When running in FIPS mode python-cryptography refuses to produce password-encrypted TraditionalOpenSSL (PKCS#1) PEM output:

  ValueError: Encrypted traditional OpenSSL format is not supported in FIPS mode

Legacy PEM password encryption uses non-FIPS-approved KDFs not permitted in FIPS mode.
Follow exising pattern of probing the optional crypto capability and calling self.skipTest() when the backend does not provide it.

When running in FIPS mode python-cryptography refuses to produce
password-encrypted TraditionalOpenSSL (PKCS#1) PEM output:

  ValueError: Encrypted traditional OpenSSL format is not supported in FIPS mode

Legacy PEM password encryption uses non-FIPS-approved KDFs not
permitted in FIPS mode.
Follow exising pattern of probing the optional crypto capability and
calling self.skipTest() when the backend does not provide it.

Signed-off-by: Stewart Smith <trawets@amazon.com>
Comment thread test/test_types.py
try:
pem = priv.to_pem(pub.publicArea, password=b"foo")
except ValueError as e:
if "FIPS mode" in str(e):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the full error string, so we don't accidentally match any other errors?

Comment thread test/test_types.py
pem = priv.to_pem(pub.publicArea, password=b"foo")
except ValueError as e:
if "FIPS mode" in str(e):
self.skipTest(str(e))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A explicit reason why the test is skipped would be good, something like "not supported when OpenSSL is in FIPS mode" or similar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants