blob: 6627f0208694e8de036561d1e234887fb73f6ec1 [file] [log] [blame]
Jeff Thompsonba16b8f2013-12-16 13:11:47 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * See COPYING for copyright and distribution information.
6 */
7
8#ifndef NDN_SHA256_RSA_HANDLER_HPP
9#define NDN_SHA256_RSA_HANDLER_HPP
10
11#include "../../data.hpp"
12#include "../certificate/public-key.hpp"
13
14namespace ndn{
15
16class Sha256WithRsaHandler {
17public:
18 Sha256WithRsaHandler() {}
19
20 virtual
21 ~Sha256WithRsaHandler() {}
22
23 /**
24 * Verify the signature on the data packet using the given public key. If there is no data.getDefaultWireEncoding(),
25 * this calls data.wireEncode() to set it.
26 * @param data The data packet with the signed portion and the signature to verify. The data packet must have a
27 * Sha256WithRsaSignature.
28 * @param publicKey The public key used to verify the signature.
29 * @return true if the signature verifies, false if not.
30 * @throw SecurityException if data does not have a Sha256WithRsaSignature.
31 */
32 static bool
Jeff Thompson2105dbe2013-12-18 16:16:28 -080033 verifySignature(const Data& data, const PublicKey& publicKey);
Jeff Thompsonba16b8f2013-12-16 13:11:47 -080034
35};
36
37}
38#endif