NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 
89  explicit
90  SigningInfo(const std::string& signingStr);
91 
96  void
97  setSigningIdentity(const Name& identity);
98 
103  void
104  setSigningKeyName(const Name& keyName);
105 
110  void
111  setSigningCertName(const Name& certificateName);
112 
117  void
119 
123  SignerType
125  {
126  return m_type;
127  }
128 
132  const Name&
134  {
135  return m_name;
136  }
137 
141  void
143  {
144  m_digestAlgorithm = algorithm;
145  }
146 
152  {
153  return m_digestAlgorithm;
154  }
155 
159  void
160  setSignatureInfo(const SignatureInfo& signatureInfo);
161 
165  const SignatureInfo&
167  {
168  return m_info;
169  }
170 
171 public:
172  static const Name EMPTY_NAME;
174 
175 private:
176  SignerType m_type;
177  Name m_name;
178 
179  DigestAlgorithm m_digestAlgorithm;
180 
181  SignatureInfo m_info;
182 };
183 
184 std::ostream&
185 operator<<(std::ostream& os, const SigningInfo& si);
186 
187 } // namespace security
188 } // namespace ndn
189 
190 #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 SignatureInfo & getSignatureInfo() const
DigestAlgorithm getDigestAlgorithm() 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.
std::ostream & operator<<(std::ostream &os, CommandInterestValidator::ErrorCode error)
const Name & getSignerName() const
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;.
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
static const SignatureInfo EMPTY_SIGNATURE_INFO
SignerType getSignerType() const