Пример #1
0
test_code_t
test_export_info (gnutls_session session)
{
  int ret2, ret;
  gnutls_datum exp2, mod2;
  const char *print;

  if (verbose == 0 || export_true == 0)
    return TEST_IGNORE;

  ADD_ALL_COMP (session);
  ADD_ALL_CERTTYPES (session);
  ADD_ALL_PROTOCOLS (session);
  ADD_ALL_MACS (session);

  ADD_KX (session, GNUTLS_KX_RSA_EXPORT);
  ADD_CIPHER (session, GNUTLS_CIPHER_ARCFOUR_40);
  gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);

  ret = do_handshake (session);

  if (ret == TEST_SUCCEED)
    {
      ret2 = gnutls_rsa_export_get_pubkey (session, &exp2, &mod2);
      if (ret2 >= 0)
	{
	  printf ("\n");

	  print = raw_to_string (exp2.data, exp2.size);
	  if (print)
	    printf (" Exponent [%d bits]: %s\n", exp2.size * 8, print);

	  print = raw_to_string (mod2.data, mod2.size);
	  if (print)
	    printf (" Modulus [%d bits]: %s\n", mod2.size * 8, print);

	  if (mod2.size != mod.size || exp2.size != exp.size ||
	      memcmp (mod2.data, mod.data, mod.size) != 0 ||
	      memcmp (exp2.data, exp.data, exp.size) != 0)
	    {
	      printf
		(" (server uses different public keys per connection)\n");
	    }
	}
    }

  return ret;

}
Пример #2
0
test_code_t
test_arcfour_40 (gnutls_session session)
{
  int ret;
  ADD_CIPHER (session, GNUTLS_CIPHER_ARCFOUR_40);
  ADD_ALL_COMP (session);
  ADD_ALL_CERTTYPES (session);
  ADD_ALL_PROTOCOLS (session);
  ADD_ALL_MACS (session);
  ADD_ALL_KX (session);
  gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);

  ret = do_handshake (session);
  return ret;
}
Пример #3
0
test_code_t
test_3des (gnutls_session_t session)
{
    int ret;
    ADD_CIPHER (session, GNUTLS_CIPHER_3DES_CBC);
    ADD_ALL_COMP (session);
    ADD_ALL_CERTTYPES (session);
    ADD_ALL_PROTOCOLS (session);
    ADD_ALL_MACS (session);
    ADD_ALL_KX (session);
    gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);

    ret = do_handshake (session);
    return ret;
}
Пример #4
0
test_code_t
test_export (gnutls_session session)
{
  int ret;

  ADD_ALL_COMP (session);
  ADD_ALL_CERTTYPES (session);
  ADD_ALL_PROTOCOLS (session);
  ADD_ALL_MACS (session);

  ADD_KX (session, GNUTLS_KX_RSA_EXPORT);
  ADD_CIPHER (session, GNUTLS_CIPHER_ARCFOUR_40);
  gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);

  ret = do_handshake (session);

  if (ret == TEST_SUCCEED)
    {
      export_true = 1;
      gnutls_rsa_export_get_pubkey (session, &exp, &mod);
    }

  return ret;
}