Exemple #1
0
from pyfilesec import SecFile, GenRSA
import os

# Logging is available, optional:
# from psychopy import logging
# logging.console.setLevel(logging.INFO)
# pfs.logging = logging

# We need a data file to encrypt, e.g., containing "sensitive" info:
datafile = 'data.txt'
with open(datafile, 'wb') as file:
    file.write("confidential data, e.g., participant's drug-use history")

# To set up for encryption, give it to a SecFile:
sf = SecFile(datafile)
msg = 'make a file:\n  file name: "%s"\n  contents: "%s"'
print(msg % (sf.file, sf.snippet))
print('  is encrypted: %s' % sf.is_encrypted)

# These particular RSA keys are ONLY for testing
# see pyfilesec.genrsa() to make your own keys)
# paths to new tmp files that hold the keys
pubkey, privkey, passphrase = GenRSA().demo_rsa_keys()

# To encrypt the file, use the RSA public key:
sf.encrypt(pubkey)
msg = 'ENCRYPT it:\n  file name: "%s"\n  contents (base64): "%s . . ."'
print(msg % (sf.file, sf.snippet))
print('  is encrypted: %s' % sf.is_encrypted)
Exemple #2
0
from pyfilesec import SecFile
s = SecFile("creditcard.csv")
s.encrypt("pub_RSA.pem")

Exemple #3
0
            'decrypt:\n' + decrypt(str(self.etxt.get()), privatekey) + '\n')
        self.history.config(state='disabled')
        self.history.see(Tkinter.END)
        #print "decrypt click!"

    def clear_both(self):
        self.etxt.set('')
        self.ptxt.set('')

    def clear_history(self):
        self.history.config(state='normal')
        self.history.delete(0.0, Tkinter.END)
        self.history.config(state='disabled')
        pass


'''if __name__ == "__main__":
    app = crypt_mod(None)
    app.title('Honey Encryption(RSA)')
    app.mainloop()
'''

if __name__ == "__main__":
    SS = SecFile("creditcard.enc")
    rr = raw_input("Enter Phrase: ")
    SS.decrypt("priv_RSA.pem", rr)
    app = crypt_mod(None)
    app.title('Honey Encryption(RSA)')
    app.mainloop()
    SS.encrypt("pub_RSA.pem")
from pyfilesec import SecFile, GenRSA
import os

# Logging is available, optional:
# from psychopy import logging
# logging.console.setLevel(logging.INFO)
# pfs.logging = logging

# We need a data file to encrypt, e.g., containing "sensitive" info:
datafile = 'data.txt'
with open(datafile, 'wb') as file:
    file.write("confidential data, e.g., participant's drug-use history")

# To set up for encryption, give it to a SecFile:
sf = SecFile(datafile)
msg = 'make a file:\n  file name: "%s"\n  contents: "%s"'
print msg % (sf.file, sf.snippet)
print '  is encrypted: %s' % sf.is_encrypted

# These particular RSA keys are ONLY for testing
# see pyfilesec.genrsa() to make your own keys)
# paths to new tmp files that hold the keys
pubkey, privkey, passphrase = GenRSA().demo_rsa_keys()

# To encrypt the file, use the RSA public key:
sf.encrypt(pubkey)
msg = 'ENCRYPT it:\n  file name: "%s"\n  contents (base64): "%s . . ."'
print msg % (sf.file, sf.snippet)
print '  is encrypted: %s' % sf.is_encrypted
Exemple #5
0
def Open():
    s = SecFile("creditcard.enc")
    r = raw_input("Enter phrase: ")
    s.decrypt("priv_RSA.pem", r)
Exemple #6
0
def Open():
	s = SecFile("fruitcsv.enc")
	r = raw_input("Enter phrase: ")
	s.decrypt("priv_RSA.pem",r)
Exemple #7
0
def Close():
    	s = SecFile("fruitcsv.csv")
	s.encrypt("pub_RSA.pem")