Example #1
0
int verify_asset_signature(tx_asset_t *asset, shpeer_t *peer)
{
  uint64_t crc;
  int err;

  crc = shcrc((unsigned char *)asset->ass_data, asset->ass_size);
  err = shkey_verify(shpeer_kpriv(peer), crc, 
      &asset->ass.ass_sig, asset->ass.ass_expire);
  if (err)
    return (err);

  return (0);
}
Example #2
0
/** Determine whether the appropriate context is availale. */
int txward_context_confirm(tx_ward_t *ward, tx_context_t *ctx)
{
  int err;

  if (!shkey_cmp(&ward->ward_ref, &ctx->ctx_ref))
    return (SHERR_INVAL);

  err = shkey_verify(&ward->ward_sig, shkey_crc(&ctx->ctx_ref), 
    &ctx->ctx_sig, ward->ward_tx.tx_stamp);
  if (err)
    return (err);

  return (0);
}
Example #3
0
static int validate_asset_signature(tx_asset_t *asset)
{
  shpeer_t *peer;
  uint64_t crc;
  int err;

  peer = load_asset_peer(&asset->ass.ass_id);
  if (!peer)
    return (SHERR_INVAL);

  crc = shcrc((unsigned char *)asset->ass_data, asset->ass_size);
  err = shkey_verify(shpeer_kpriv(peer), crc, 
      &asset->ass.ass_sig, asset->ass.ass_expire);
  if (err)
    return (err);

  return (0);
}