Jeff Thompson | ba16b8f | 2013-12-16 13:11:47 -0800 | [diff] [blame] | 1 | /* -*- 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 | |
| 14 | namespace ndn{ |
| 15 | |
| 16 | class Sha256WithRsaHandler { |
| 17 | public: |
| 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 Thompson | 2105dbe | 2013-12-18 16:16:28 -0800 | [diff] [blame] | 33 | verifySignature(const Data& data, const PublicKey& publicKey); |
Jeff Thompson | ba16b8f | 2013-12-16 13:11:47 -0800 | [diff] [blame] | 34 | |
| 35 | }; |
| 36 | |
| 37 | } |
| 38 | #endif |