-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
73 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef NDNPH_KEYCHAIN_NULL_KEY_HPP | ||
#define NDNPH_KEYCHAIN_NULL_KEY_HPP | ||
|
||
#include "private-key.hpp" | ||
#include "public-key.hpp" | ||
|
||
namespace ndnph { | ||
|
||
/** | ||
* @brief Null signature: packet is not signed. | ||
* | ||
* Signing produces an empty signature. | ||
* Verification does nothing and accepts any signature type. | ||
* | ||
* @note This is intended in testing environments or for experimental purposes. | ||
* @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/NullSignature | ||
*/ | ||
class NullKey | ||
: public PrivateKey | ||
, public PublicKey | ||
{ | ||
public: | ||
static const NullKey& get() | ||
{ | ||
static NullKey instance; | ||
return instance; | ||
} | ||
|
||
size_t getMaxSigLen() const final | ||
{ | ||
return 0; | ||
} | ||
|
||
void updateSigInfo(SigInfo& sigInfo) const final | ||
{ | ||
sigInfo.sigType = SigType::Null; | ||
sigInfo.name = Name(); | ||
} | ||
|
||
ssize_t sign(std::initializer_list<tlv::Value>, uint8_t*) const final | ||
{ | ||
return 0; | ||
} | ||
|
||
bool matchSigInfo(const SigInfo&) const final | ||
{ | ||
return true; | ||
} | ||
|
||
bool verify(std::initializer_list<tlv::Value>, const uint8_t*, size_t) const final | ||
{ | ||
return true; | ||
} | ||
}; | ||
|
||
} // namespace ndnph | ||
|
||
#endif // NDNPH_KEYCHAIN_NULL_KEY_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters