Skip to content

CryptographyDeprecationWarning for _permission (not_valid_before and not_valid_after) #347

@cdisco

Description

@cdisco

The following warning was observerned when running ros2 security create_enclave in a bazel environment.

INFO: Running command line: bazel-bin/ros2/ros2_security create_enclave /tmp/MY_ENCLAVE /MY_ENCLAVE_NAME
/home/user/.cache/bazel/_bazel_/9aa7afc3a0e2498fab67e6e6e7243812/execroot/rules_ros2/bazel-out/k8-opt/bin/ros2/ros2sec.runfiles/sros2/sros2/sros2/keystore/_permission.py:78: 
CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. 
Please switch to not_valid_before_utc.kwargs['not_valid_before'] = etree.XSLT.strparam(cert_content.not_valid_before.isoformat())

/home/user/.cache/bazel/_bazel_/9aa7afc3a0e2498fab67e6e6e7243812/execroot/rules_ros2/bazel-out/k8-opt/bin/ros2/ros2sec.runfiles/sros2/sros2/sros2/keystore/_permission.py:79: 
CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. 
Please switch to not_valid_after_utc.kwargs['not_valid_after'] = etree.XSLT.strparam(cert_content.not_valid_after.isoformat())

Here are the offending lines:

kwargs['not_valid_before'] = etree.XSLT.strparam(cert_content.not_valid_before.isoformat())

The solution is to use not_valid_before_utc and not_valid_after_utc respectively

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions