def decrypt(self): ''' fi.decrypt() -> None Decrypts a file that was encrypted by the current account using the Encrypt method. This method is win32 only. ''' try: import win32file except: raise NotSupportedException("this method is win32 only") win32file.DecryptFile(self.original_path)
def testEncrypt(self): fname = tempfile.mktemp("win32file_test") f = open(fname, "wb") f.write(str2bytes("hello")) f.close() f = None try: try: win32file.EncryptFile(fname) except win32file.error, details: if details.winerror != winerror.ERROR_ACCESS_DENIED: raise print "It appears this is not NTFS - cant encrypt/decrypt" win32file.DecryptFile(fname)