-consistently use struct GNUNET_HashCode
[oweals/gnunet.git] / src / namestore / test_namestore_api_sign_verify.c
index 8a350ac8552eea5b601a5967fe9f6e838725b89c..17bfb1effe6f3ebdf1bdc8af0cbd4f44f0b82f02 100644 (file)
@@ -74,8 +74,14 @@ run (void *cls, char *const *args, const char *cfgfile,
   struct GNUNET_CRYPTO_RsaSignature * signature;
 
   /* load privat key */
-  privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey");
+  char *hostkey_file;
+  GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
+      "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
+  privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
+  GNUNET_free (hostkey_file);
   GNUNET_assert (privkey != NULL);
+  struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get();
   /* get public key */
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
 
@@ -86,18 +92,19 @@ run (void *cls, char *const *args, const char *cfgfile,
   s_name = "dummy.dummy.gnunet";
   s_rd = create_record (RECORDS);
 
-  signature = GNUNET_NAMESTORE_create_signature (privkey, s_name, s_rd, RECORDS);
+  signature = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, s_rd, RECORDS);
   GNUNET_assert (signature != NULL);
 
-  res_c = GNUNET_NAMESTORE_verify_signature(&pubkey, s_name, RECORDS, s_rd, signature);
+  res_c = GNUNET_NAMESTORE_verify_signature(&pubkey, expire, s_name, RECORDS, s_rd, signature);
   GNUNET_break (res == GNUNET_OK);
 
   GNUNET_free (signature);
 
-  signature = GNUNET_NAMESTORE_create_signature (privkey, s_name, s_rd, RECORDS);
+  signature = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, s_rd, RECORDS);
   GNUNET_break (signature != NULL);
 
-  res_w = GNUNET_NAMESTORE_verify_signature(&pubkey, s_name, RECORDS - 1, s_rd, signature);
+  GNUNET_log_skip(1, GNUNET_NO);
+  res_w = GNUNET_NAMESTORE_verify_signature(&pubkey, expire, s_name, RECORDS - 1, s_rd, signature);
   GNUNET_break (res_w == GNUNET_SYSERR);
 
   GNUNET_free (signature);