NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
signing-info.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_SIGNING_INFO_HPP
23 #define NDN_SECURITY_SIGNING_INFO_HPP
24 
25 #include "../name.hpp"
26 #include "../signature-info.hpp"
27 #include "security-common.hpp"
28 
29 
30 namespace ndn {
31 namespace security {
32 
37 {
38 public:
39  class Error : public std::runtime_error
40  {
41  public:
42  explicit
43  Error(const std::string& what)
44  : std::runtime_error(what)
45  {
46  }
47  };
48 
49  enum SignerType {
60  };
61 
62 public:
72  explicit
74  const Name& signerName = EMPTY_NAME,
75  const SignatureInfo& signatureInfo = EMPTY_SIGNATURE_INFO);
76 
81  void
82  setSigningIdentity(const Name& identity);
83 
88  void
89  setSigningKeyName(const Name& keyName);
90 
95  void
96  setSigningCertName(const Name& certificateName);
97 
102  void
104 
108  SignerType
110  {
111  return m_type;
112  }
113 
117  const Name&
119  {
120  return m_name;
121  }
122 
126  void
128  {
129  m_digestAlgorithm = algorithm;
130  }
131 
137  {
138  return m_digestAlgorithm;
139  }
140 
144  void
145  setSignatureInfo(const SignatureInfo& signatureInfo);
146 
150  const SignatureInfo&
152  {
153  return m_info;
154  }
155 
156 public:
157  static const Name EMPTY_NAME;
159 
160 private:
161  SignerType m_type;
162  Name m_name;
163 
164  DigestAlgorithm m_digestAlgorithm;
165 
166  SignatureInfo m_info;
167 };
168 
169 } // namespace security
170 } // namespace ndn
171 
172 #endif // NDN_SECURITY_SIGNING_INFO_HPP
SigningInfo(SignerType signerType=SIGNER_TYPE_NULL, const Name &signerName=EMPTY_NAME, const SignatureInfo &signatureInfo=EMPTY_SIGNATURE_INFO)
Constructor.
Copyright (c) 2011-2015 Regents of the University of California.
const Name & getSignerName() const
void setSigningCertName(const Name &certificateName)
Set signer as a certificate with name certificateName.
STL namespace.
use sha256 digest, no signer needs to be specified
Signing parameters passed to KeyChain.
static const Name EMPTY_NAME
void setSigningIdentity(const Name &identity)
Set signer as an identity with name identity.
no signer is specified, use default setting or follow the trust schema
void setSha256Signing()
Set Sha256 as the signing method.
void setSignatureInfo(const SignatureInfo &signatureInfo)
Set a semi-prepared SignatureInfo;.
const SignatureInfo & getSignatureInfo() const
Error(const std::string &what)
void setDigestAlgorithm(const DigestAlgorithm &algorithm)
Set the digest algorithm for public key operations.
Name abstraction to represent an absolute name.
Definition: name.hpp:46
signer is a certificate, use it directly
signer is a key, use its default certificate
void setSigningKeyName(const Name &keyName)
Set signer as a key with name keyName.
signer is an identity, use its default key and default certificate
DigestAlgorithm getDigestAlgorithm() const
static const SignatureInfo EMPTY_SIGNATURE_INFO
SignerType getSignerType() const