SSCANF (&s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) * 2],
"%llu", &flen)))
{
- *emsg = GNUNET_strdup (_("SKS URI malformed"));
+ *emsg = GNUNET_strdup (_("LOC URI malformed"));
return NULL;
}
ass.fi.file_length = GNUNET_htonll (flen);
npos++;
if (s[npos] == '\0')
{
- *emsg = GNUNET_strdup (_("SKS URI malformed"));
+ *emsg = GNUNET_strdup (_("LOC URI malformed"));
goto ERR;
}
npos++;
if (ret == -1)
{
*emsg =
- GNUNET_strdup (_("SKS URI malformed (could not decode public key)"));
+ GNUNET_strdup (_("LOC URI malformed (could not decode public key)"));
goto ERR;
}
npos += ret;
}
ass.purpose.size = htonl (sizeof (struct LocUriAssembly));
ass.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT);
- et.abs_value = exptime;
+ et.abs_value_us = exptime * 1000LL * 1000LL;
ass.exptime = GNUNET_TIME_absolute_hton (et);
if (GNUNET_OK !=
GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT,
struct GNUNET_CRYPTO_EccPublicKey my_public_key;
char *keyfile;
struct LocUriAssembly ass;
+ struct GNUNET_TIME_Absolute et;
if (baseUri->type != GNUNET_FS_URI_CHK)
return NULL;
return NULL;
}
GNUNET_free (keyfile);
+ /* we round expiration time to full seconds for SKS URIs */
+ et.abs_value_us = (expiration_time.abs_value_us / 1000000LL) * 1000000LL;
GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
ass.purpose.size = htonl (sizeof (struct LocUriAssembly));
ass.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT);
- ass.exptime = GNUNET_TIME_absolute_hton (expiration_time);
+ ass.exptime = GNUNET_TIME_absolute_hton (et);
ass.fi = baseUri->data.chk;
ass.peer = my_public_key;
uri = GNUNET_new (struct GNUNET_FS_Uri);
uri->type = GNUNET_FS_URI_LOC;
uri->data.loc.fi = baseUri->data.chk;
- uri->data.loc.expirationTime = expiration_time;
+ uri->data.loc.expirationTime = et;
uri->data.loc.peer = my_public_key;
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_ecc_sign (my_private_key, &ass.purpose,
&uri->data.loc.contentSignature));
- GNUNET_CRYPTO_ecc_key_free (my_private_key);
+ GNUNET_free (my_private_key);
return uri;
}
}
-/**
- * Convert namespace URI to a human readable format
- * (using the namespace description, if available).
- *
- * @param cfg configuration to use
- * @param uri SKS uri to convert
- * @return NULL on error (not an SKS URI)
- */
-char *
-GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_FS_Uri *uri)
-{
- char *ret;
- char *name;
- char *unique_name;
-
- if (uri->type != GNUNET_FS_URI_SKS)
- return NULL;
- (void) GNUNET_FS_pseudonym_get_info (cfg, &uri->data.sks.ns,
- NULL, NULL, &name, NULL);
- unique_name = GNUNET_FS_pseudonym_name_uniquify (cfg, &uri->data.sks.ns, name, NULL);
- GNUNET_free (name);
- GNUNET_asprintf (&ret, "%s: %s", unique_name, uri->data.sks.identifier);
- GNUNET_free (unique_name);
- return ret;
-}
-
-
/**
* Is this a keyword URI?
*
* @param uri the uri
- * @return GNUNET_YES if this is a KSK uri
+ * @return #GNUNET_YES if this is a KSK uri
*/
int
GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri)
peerSig =
bin2enc (&uri->data.loc.contentSignature,
sizeof (struct GNUNET_CRYPTO_EccSignature));
- GNUNET_asprintf (&ret, "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX,
+ GNUNET_asprintf (&ret,
+ "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX,
GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash,
(const char *) &queryhash,
(unsigned long long) GNUNET_ntohll (uri->data.loc.
fi.file_length), peerId,
peerSig,
- (unsigned long long) uri->data.loc.expirationTime.abs_value);
+ (unsigned long long) uri->data.loc.expirationTime.abs_value_us / 1000000LL);
GNUNET_free (peerSig);
GNUNET_free (peerId);
return ret;