コード例 #1
0
from pyfilesec import SecFile
s = SecFile("creditcard.csv")
s.encrypt("pub_RSA.pem")

コード例 #2
0
ファイル: encrypt_data.py プロジェクト: wincenciak/psychopy
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)

# 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.
コード例 #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")
コード例 #4
0
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

# 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.
コード例 #5
0
ファイル: b.py プロジェクト: sakshi95/crpyt
def Close():
    s = SecFile("creditcard.csv")
    s.encrypt("pub_RSA.pem")
コード例 #6
0
ファイル: a.py プロジェクト: sakshi95/crpyt
def Close():
    	s = SecFile("fruitcsv.csv")
	s.encrypt("pub_RSA.pem")