__init__.py
1 # Reticulum License 2 # 3 # Copyright (c) 2016-2025 Mark Qvist 4 # 5 # Permission is hereby granted, free of charge, to any person obtaining a copy 6 # of this software and associated documentation files (the "Software"), to deal 7 # in the Software without restriction, including without limitation the rights 8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 # copies of the Software, and to permit persons to whom the Software is 10 # furnished to do so, subject to the following conditions: 11 # 12 # - The Software shall not be used in any kind of system which includes amongst 13 # its functions the ability to purposefully do harm to human beings. 14 # 15 # - The Software shall not be used, directly or indirectly, in the creation of 16 # an artificial intelligence, machine learning or language model training 17 # dataset, including but not limited to any use that contributes to the 18 # training or development of such a model or algorithm. 19 # 20 # - The above copyright notice and this permission notice shall be included in 21 # all copies or substantial portions of the Software. 22 # 23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 # SOFTWARE. 30 31 import os 32 import glob 33 34 from .Hashes import sha256 35 from .Hashes import sha512 36 from .HKDF import hkdf 37 from .PKCS7 import PKCS7 38 from .Token import Token 39 from .Provider import backend 40 41 import RNS.Cryptography.Provider as cp 42 43 if cp.PROVIDER == cp.PROVIDER_INTERNAL: 44 from RNS.Cryptography.X25519 import X25519PrivateKey, X25519PublicKey 45 from RNS.Cryptography.Ed25519 import Ed25519PrivateKey, Ed25519PublicKey 46 47 elif cp.PROVIDER == cp.PROVIDER_PYCA: 48 from RNS.Cryptography.Proxies import X25519PrivateKeyProxy as X25519PrivateKey 49 from RNS.Cryptography.Proxies import X25519PublicKeyProxy as X25519PublicKey 50 from RNS.Cryptography.Proxies import Ed25519PrivateKeyProxy as Ed25519PrivateKey 51 from RNS.Cryptography.Proxies import Ed25519PublicKeyProxy as Ed25519PublicKey 52 53 py_modules = glob.glob(os.path.dirname(__file__)+"/*.py") 54 pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc") 55 modules = py_modules+pyc_modules 56 __all__ = list(set([os.path.basename(f).replace(".pyc", "").replace(".py", "") for f in modules if not (f.endswith("__init__.py") or f.endswith("__init__.pyc"))]))