__init__.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # https://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """RSA module
  15. Module for calculating large primes, and RSA encryption, decryption, signing
  16. and verification. Includes generating public and private keys.
  17. WARNING: this implementation does not use compression of the cleartext input to
  18. prevent repetitions, or other common security improvements. Use with care.
  19. """
  20. from rsa.key import newkeys, PrivateKey, PublicKey
  21. from rsa.pkcs1 import (
  22. encrypt,
  23. decrypt,
  24. sign,
  25. verify,
  26. DecryptionError,
  27. VerificationError,
  28. find_signature_hash,
  29. sign_hash,
  30. compute_hash,
  31. )
  32. __author__ = "Sybren Stuvel, Barry Mead and Yesudeep Mangalapilly"
  33. __date__ = "2025-04-16"
  34. __version__ = "4.9.1"
  35. # Do doctest if we're run directly
  36. if __name__ == "__main__":
  37. import doctest
  38. doctest.testmod()
  39. __all__ = [
  40. "newkeys",
  41. "encrypt",
  42. "decrypt",
  43. "sign",
  44. "verify",
  45. "PublicKey",
  46. "PrivateKey",
  47. "DecryptionError",
  48. "VerificationError",
  49. "find_signature_hash",
  50. "compute_hash",
  51. "sign_hash",
  52. ]