Example #1
0
def DecryptOne(path, key, signature):
    with open(path, 'rb') as fin:
        org = fin.read()
        lsz = len(signature)
        if org[:lsz] != signature:
            return org
        return CipherMod.decrypt(org[lsz:], key)
Example #2
0
def DecryptOne(path, key, signature):
    with open(path, 'rb') as fin:
        org = fin.read()
        lsz = len(signature)
        if org[:lsz] != signature:
            return org
        return CipherMod.decrypt(org[lsz:], key)
Example #3
0
def EncryptOne(path, key, signature):
    with open(path, 'rb') as fin:
        org = fin.read()
        if org[:len(signature)] == signature:
            return org
        return signature + CipherMod.encrypt(org, key)
Example #4
0
def EncryptOne(path, key, signature):
    with open(path, 'rb') as fin:
        org = fin.read()
        if org[:len(signature)] == signature:
            return org
        return signature + CipherMod.encrypt(org, key)