17 lines
440 B
Python
17 lines
440 B
Python
#!/usr/bin/python
|
|
#
|
|
#
|
|
from Crypto.PublicKey import RSA
|
|
|
|
def encrypt(message):
|
|
externKey="/home/borrajax/myTestKey.pem"
|
|
privatekey = open(externKey, "r")
|
|
encryptor = RSA.importKey(privatekey, passphrase="f00bar")
|
|
encriptedData=encryptor.encrypt(message, 0)
|
|
file = open("/tmp/cryptThingy.txt", "wb")
|
|
file.write(encriptedData[0])
|
|
file.close()
|
|
|
|
if __name__ == "__main__":
|
|
encryptedThingy=encrypt("Loren ipsum")
|
|
|