Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 013fdfd
  • /
  • cryptography
  • /
  • hazmat
  • /
  • backends
  • /
  • __init__.py
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:7f74cba2c9b2abec60afb6f20c54c139ca8b528f
directory badge Iframe embedding
swh:1:dir:7a700508e3abcafd8b555d80b158126aaa808d4e
__init__.py
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.

import typing

from cryptography.hazmat.backends.interfaces import Backend

_default_backend: typing.Optional[Backend] = None


def default_backend():
    global _default_backend

    if _default_backend is None:
        from cryptography.hazmat.backends.openssl.backend import backend

        _default_backend = backend

    return _default_backend


def _get_backend(backend: typing.Optional[Backend]) -> Backend:
    if backend is None:
        return default_backend()
    else:
        return backend

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top