示例#1
0
def getDecrypter(key,iv):
    global USEDec
    if USEDec==1:
        enc =AES.new(key, AES.MODE_CBC, iv)
    elif USEDec==3:
        ivb=array.array('B',iv)
        keyb= array.array('B',key)
        enc=python_aes.new(keyb, 2, ivb)
    else:
        enc =androidsslPy._load_crypto_libcrypto()
        enc = enc(key, iv)
    return  enc       
示例#2
0
def getDecrypter(key, iv):
    global USEDec
    if USEDec == 1:
        enc = AES.new(key, AES.MODE_CBC, iv)
    elif USEDec == 3:
        ivb = array.array('B', iv)
        keyb = array.array('B', key)
        enc = python_aes.new(keyb, 2, ivb)
    else:
        enc = androidsslPy._load_crypto_libcrypto()
        enc = enc(key, iv)
    return enc
示例#3
0
    initDone=True

try:
    from Crypto.Cipher import AES

    USEDec=1 ## 1==crypto 2==local, local pycrypto
    print 'using pycrypt wooot woot'
except:
    print 'pycrypt not available trying other options'
    print traceback.print_exc()
    USEDec=3 ## 1==crypto 2==local, local pycrypto
    #check if its android
    if xbmc.getCondVisibility('System.Platform.Android'):
        try:
            import androidsslPy
            AES=androidsslPy._load_crypto_libcrypto()
            USEDec=2 ## android
            print 'using android ssllib woot woot'
        except: 
            print traceback.print_exc()
            print 'android copy not available'    
            from f4mUtils import python_aes
            print 'using slow decryption'  
    else:
        print 'using slow decryption'  
        from f4mUtils import python_aes


value_unsafe = '%+&;#'
VALUE_SAFE = ''.join(chr(c) for c in range(33, 127)
    if chr(c) not in value_unsafe)
示例#4
0

##aes stuff - custom crypto implementation
_android_ssl = False
_oscrypto = False
_dec = False
_crypto = 'None'

try:
    from Cryptodome.Cipher import AES
    _dec = True
    _crypto = 'CryptoDome'
except ImportError:
    try:
        import androidsslPy
        enc = androidsslPy._load_crypto_libcrypto()
        _android_ssl = True
        _dec = True
        _crypto = 'androidsslPy'
    except:
        try:
            from oscrypto.symmetric import aes_cbc_no_padding_decrypt
            class AES(object):
                def __init__(self,key,iv):
                    self.key=key
                    self.iv=iv
                def decrypt(self, data):
                    return aes_cbc_no_padding_decrypt(self.key, data, self.iv)
            _oscrypto = True
            _dec = True
            _crypto = 'OSCrypto'