blob: 1d2927e9d8cf7e2dfaba48ef51a187d70b21b645 [file] [log] [blame]
Jeff Thompson3f3cfd32013-09-27 11:46:52 -07001/* -*- 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 Yu4f324632014-01-15 18:10:03 -08009#ifndef NDN_SEC_POLICY_NO_VERIFY_HPP
10#define NDN_SEC_POLICY_NO_VERIFY_HPP
Jeff Thompson3f3cfd32013-09-27 11:46:52 -070011
Yingdi Yu4f324632014-01-15 18:10:03 -080012#include "sec-policy.hpp"
Jeff Thompson3f3cfd32013-09-27 11:46:52 -070013
14namespace ndn {
15
Yingdi Yu4f324632014-01-15 18:10:03 -080016class SecPolicyNoVerify : public SecPolicy {
Jeff Thompson3f3cfd32013-09-27 11:46:52 -070017public:
18 /**
19 * The virtual destructor.
20 */
21 virtual
Yingdi Yu4f324632014-01-15 18:10:03 -080022 ~SecPolicyNoVerify();
Jeff Thompson3f3cfd32013-09-27 11:46:52 -070023
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 Thompson31aeed82013-11-25 15:44:45 -080050 (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed);
Jeff Thompson3f3cfd32013-09-27 11:46:52 -070051
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