sys.exit(-2) # set app metadata agent.setmetadata({ "ionic-application-name": "Ionic-Ciphers Tutorial", "ionic-application-version": "1.0.0" }) ########################################################### ## SENDER ########################################################### message = "this is a secret message!" # initialize chunk cipher sender_cipher = ionicsdk.ChunkCipherAuto(agent) # encrypt data ciphertext = sender_cipher.encryptstr(message) print("CIPHERTEXT : " + ciphertext) ########################################################### ## RECEIVER ########################################################### # initialize chunk cipher receiver_cipher = ionicsdk.ChunkCipherAuto(agent) # decrypt data plaintext = receiver_cipher.decryptstr(ciphertext)
print("Error initializing agent: {0}".format(e.message)) sys.exit(-3) # Check if there are profiles. if not agent.hasanyprofiles() or not agent.hasactiveprofile(): if not agent.hasanyprofiles(): print("There are no device profiles on this device.") if not agent.hasactiveprofile(): print("There is not an active device profile selected on this device.") print( "Register (and select an active profile) this device before continuing." ) sys.exit(-1) # Initialize a Chunk Cipher for doing string encryption cipher = ionicsdk.ChunkCipherAuto(agent) # Make sure log file exists emptyFileCheck(logFile) #Start print( "I am the all-seeing magic 8 ball.\nAsk me your most pressing questions and I shall provide an answer.\nDon't worry though, I'll keep your questions a secret\n" ) print("To see you question history, type 'history'\n") magic_question() #keep playing loop keepPlaying = input( "Would you like to ask the Wise One another question? Y/N: ") while (keepPlaying.lower() != "y" and keepPlaying.lower() != "n"):