codekingpro/portable-devtools
114k
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 at6#7# https://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# 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 and13# limitations under the License.14"""RSA module15 16Module for calculating large primes, and RSA encryption, decryption, signing17and verification. Includes generating public and private keys.18 19WARNING: this implementation does not use compression of the cleartext input to20prevent repetitions, or other common security improvements. Use with care.21 22"""23 24from rsa.key import newkeys, PrivateKey, PublicKey25from rsa.pkcs1 import (26 encrypt,27 decrypt,28 sign,29 verify,30 DecryptionError,31 VerificationError,32 find_signature_hash,33 sign_hash,34 compute_hash,35)36 37__author__ = "Sybren Stuvel, Barry Mead and Yesudeep Mangalapilly"38__date__ = "2022-07-20"39__version__ = "4.9"40 41# Do doctest if we're run directly42if __name__ == "__main__":43 import doctest44 45 doctest.testmod()46 47__all__ = [48 "newkeys",49 "encrypt",50 "decrypt",51 "sign",52 "verify",53 "PublicKey",54 "PrivateKey",55 "DecryptionError",56 "VerificationError",57 "find_signature_hash",58 "compute_hash",59 "sign_hash",60]61 