codekingpro/portable-devtools
114k
1# Copyright (c) 2023, exiledkingcc2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions are6# met:7#8# * Redistributions of source code must retain the above copyright notice,9# this list of conditions and the following disclaimer.10# * Redistributions in binary form must reproduce the above copyright notice,11# this list of conditions and the following disclaimer in the documentation12# and/or other materials provided with the distribution.13# * The name of the author may not be used to endorse or promote products14# derived from this software without specific prior written permission.15#16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE26# POSSIBILITY OF SUCH DAMAGE.27 28from pypdf._crypt_providers._base import CryptBase, CryptIdentity29 30try:31 from pypdf._crypt_providers._cryptography import (32 CryptAES,33 CryptRC4,34 aes_cbc_decrypt,35 aes_cbc_encrypt,36 aes_ecb_decrypt,37 aes_ecb_encrypt,38 crypt_provider,39 rc4_decrypt,40 rc4_encrypt,41 )42except ImportError:43 try:44 from pypdf._crypt_providers._pycryptodome import ( # type: ignore45 CryptAES,46 CryptRC4,47 aes_cbc_decrypt,48 aes_cbc_encrypt,49 aes_ecb_decrypt,50 aes_ecb_encrypt,51 crypt_provider,52 rc4_decrypt,53 rc4_encrypt,54 )55 except ImportError:56 from pypdf._crypt_providers._fallback import ( # type: ignore57 CryptAES,58 CryptRC4,59 aes_cbc_decrypt,60 aes_cbc_encrypt,61 aes_ecb_decrypt,62 aes_ecb_encrypt,63 crypt_provider,64 rc4_decrypt,65 rc4_encrypt,66 )67 68__all__ = [69 "CryptAES",70 "CryptBase",71 "CryptIdentity",72 "CryptRC4",73 "aes_cbc_decrypt",74 "aes_cbc_encrypt",75 "aes_ecb_decrypt",76 "aes_ecb_encrypt",77 "crypt_provider",78 "rc4_decrypt",79 "rc4_encrypt",80]81 