Exemple #1
0
    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)

# To decrypt the file, use the matching RSA private key (and its passphrase):
sf.decrypt(privkey, passphrase)
msg = 'DECRYPT it:\n  file name: "%s"\n  contents: "%s"'
print(msg % (sf.file, sf.snippet))
print('  is encrypted: %s' % sf.is_encrypted)

# clean-up the tmp files:
for file in [sf.file, pubkey, privkey, passphrase]:
    os.unlink(file)

# The contents of this file are in the public domain.
Exemple #2
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")
Exemple #3
0
def Open():
    s = SecFile("creditcard.enc")
    r = raw_input("Enter phrase: ")
    s.decrypt("priv_RSA.pem", r)
    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

# To decrypt the file, use the matching RSA private key (and its passphrase):
sf.decrypt(privkey, passphrase)
msg = 'DECRYPT it:\n  file name: "%s"\n  contents: "%s"'
print msg % (sf.file, sf.snippet)
print '  is encrypted: %s' % sf.is_encrypted

# clean-up the tmp files:
for file in [sf.file, pubkey, privkey, passphrase]:
    os.unlink(file)

# The contents of this file are in the public domain.
Exemple #5
0
def Open():
	s = SecFile("fruitcsv.enc")
	r = raw_input("Enter phrase: ")
	s.decrypt("priv_RSA.pem",r)