Esempio n. 1
0
void 
NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
{
  if (ndndIdData->getSignature().getType() == Signature::Sha256WithRsa)
    {
      ndndId_.resize(32);
      ndn_digestSha256(ndndIdData->getContent().value(), ndndIdData->getContent().value_size(), ndndId_.buf());
      onSuccess_();
    }
  else
    onFailure_();
}
ptr_lib::shared_ptr<ValidationRequest>
SelfVerifyPolicyManager::checkVerificationPolicy
  (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
{
  // wireEncode returns the cached encoding if available.
  if (verify(data->getSignature(), data->wireEncode()))
    onVerified(data);
  else
    onVerifyFailed(data);

  // No more steps, so return a null ValidationRequest.
  return ptr_lib::shared_ptr<ValidationRequest>();
}