Exemple #1
0
def AuthenticateMessage():
  import base64
  print "This should return None"
  reply = ds_client.AuthenticateMessage(base64.b64encode("Hello DS"))
  print "Actually is", reply.data
  print "-----------------------------------------------"
  print "This should complete successfully"
  import local
  test_dir = local.find_data_directory("test_msgs")
  f = file(os.path.join(test_dir,"AuthenticateMessage-test.txt"),"r")
  text = f.read()
  f.close()
  reply = ds_client.AuthenticateMessage(text)
  print "Actually is", reply.status
  print "Message verified successfully:", reply.data
Exemple #2
0
       if test_id < len(tests):
         to_run.append(tests[test_id])
       else:
         sys.stderr.write("Test %d does not exist!\n" % test_id)
     else:
       for test in tests:
         if test.__name__ == test_name:
           to_run.append(test)
           break
       else:
         sys.stderr.write("Test '%s' does not exist!\n" % test_name)
 # run the tests
 if to_run:
   # setup the client argument and attributes
   import local
   cert_dir = local.find_data_directory("trusted_certificates")
   args = dict(test_environment=options.test_account,
               server_certs=os.path.join(cert_dir, "all_trusted.pem"),
               login_method=login_method
               )
   # process specific things
   if login_method in ("certificate", "user_certificate"):
     if options.p12file:
       # PKCS12 file certificate and key storage
       import OpenSSL
       f = file(options.p12file, 'rb')
       p12text = f.read()
       f.close()
       import getpass
       password = getpass.getpass("Enter PKSC12 file password:")
       try: