Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [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 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
| 6 | * See COPYING for copyright and distribution information. |
| 7 | */ |
| 8 | |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 9 | #ifndef NDN_SEC_POLICY_NO_VERIFY_HPP |
| 10 | #define NDN_SEC_POLICY_NO_VERIFY_HPP |
Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [diff] [blame] | 11 | |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 12 | #include "sec-policy.hpp" |
Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [diff] [blame] | 13 | |
| 14 | namespace ndn { |
| 15 | |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 16 | class SecPolicyNoVerify : public SecPolicy { |
Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [diff] [blame] | 17 | public: |
| 18 | /** |
| 19 | * The virtual destructor. |
| 20 | */ |
| 21 | virtual |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 22 | ~SecPolicyNoVerify(); |
Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Override to always skip verification and trust as valid. |
| 26 | * @param data The received data packet. |
| 27 | * @return true. |
| 28 | */ |
| 29 | virtual bool |
| 30 | skipVerifyAndTrust(const Data& data); |
| 31 | |
| 32 | /** |
| 33 | * Override to return false for no verification rule for the received data. |
| 34 | * @param data The received data packet. |
| 35 | * @return false. |
| 36 | */ |
| 37 | virtual bool |
| 38 | requireVerify(const Data& data); |
| 39 | |
| 40 | /** |
| 41 | * Override to call onVerified(data) and to indicate no further verification step. |
| 42 | * @param data The Data object with the signature to check. |
| 43 | * @param stepCount The number of verification steps that have been done, used to track the verification progress. |
| 44 | * @param onVerified This does override to call onVerified(data). |
| 45 | * @param onVerifyFailed Override to ignore this. |
| 46 | * @return null for no further step. |
| 47 | */ |
| 48 | virtual ptr_lib::shared_ptr<ValidationRequest> |
| 49 | checkVerificationPolicy |
Jeff Thompson | 31aeed8 | 2013-11-25 15:44:45 -0800 | [diff] [blame] | 50 | (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed); |
Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Override to always indicate that the signing certificate name and data name satisfy the signing policy. |
| 54 | * @param dataName The name of data to be signed. |
| 55 | * @param certificateName The name of signing certificate. |
| 56 | * @return true to indicate that the signing certificate can be used to sign the data. |
| 57 | */ |
| 58 | virtual bool |
| 59 | checkSigningPolicy(const Name& dataName, const Name& certificateName); |
| 60 | |
| 61 | /** |
| 62 | * Override to indicate that the signing identity cannot be inferred. |
| 63 | * @param dataName The name of data to be signed. |
| 64 | * @return An empty name because cannot infer. |
| 65 | */ |
| 66 | virtual Name |
| 67 | inferSigningIdentity(const Name& dataName); |
| 68 | }; |
| 69 | |
| 70 | } |
| 71 | |
| 72 | #endif |