blob: 99b550d1483b4d87075a2a9337ed4474ae055c66 [file] [log] [blame]
Yingdi Yu21157162014-02-28 13:02:34 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NDN_SECURITY_SIGNATURE_SHA256_HPP
8#define NDN_SECURITY_SIGNATURE_SHA256_HPP
9
10#include "../data.hpp"
11#include "../encoding/tlv.hpp"
12
13namespace ndn {
14
15/**
16 * Representing of SHA256 signature in a data packet.
17 */
18class SignatureSha256 : public Signature {
19public:
20 SignatureSha256()
21 {
22 info_ = Block(Tlv::SignatureInfo);
23
24 type_ = Signature::Sha256;
25 info_.push_back(nonNegativeIntegerBlock(Tlv::SignatureType, Tlv::DigestSha256));
26 }
27
28 SignatureSha256(const Signature &signature)
29 : Signature(signature)
30 {
31 if (getType() != Signature::Sha256)
32 throw Signature::Error("Incorrect signature type");
33 }
34};
35
36} // namespace ndn
37
38#endif //NDN_SECURITY_SIGNATURE_SHA256_HPP