Exemple #1
0
 def testTTR(self):
     me.set_signature("key")
     out = me.sign_and_ttr("text")
     shex = out.hex()
     #print( shex )
     self.assertEqual("746578747310d0ca6177c61c975fd2f8c07d8c6528c6", shex)
     print("\ttest TTR PASSED")
Exemple #2
0
 def testSign(self):
     #self.assertEqual( 33, me.error_handler( 33, me.ErrorType.IO, "test error" ))
     #self.assertEqual( None, error_type );
     me.set_signature("key")
     sig = me.sign_data("text")
     shex = sig.hex()
     #print( str(type(shex)) )
     self.assertEqual("d0ca6177c61c975fd2f8c07d8c6528c6", shex)
     print("\ttest Sign PASSED")
Exemple #3
0
import mqttudp.engine as me

#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
#	NB! Used in regress tests. Do not modify!
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

if __name__ == "__main__":

    parser = argparse.ArgumentParser(
        description='Send MQTT/UDP publish message', prog='test_pub')

    parser.add_argument('topic', help='topic to send to')
    parser.add_argument('value', help='value to be sent')
    parser.add_argument('-s',
                        '--signature',
                        dest='signature',
                        action='store',
                        help='digital signature key')

    args = parser.parse_args()

    if args.signature != None:
        me.set_signature(args.signature)

    print("Will publish to '" + sys.argv[1] + "' value '" + sys.argv[2] + "'")
    me.send_publish(args.topic, args.value)
    print("Sent ok")