blob: be6766b2c8737b173238094e0a09ef894b14d66c [file] [log] [blame]
Jeff Thompsonfa306642013-06-17 15:06:57 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Alexander Afanasyev
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
9 */
10
11#ifndef NDN_SIGNATURE_SHA256_WITH_RSA_H
12#define NDN_SIGNATURE_SHA256_WITH_RSA_H
13
14#include "signature.h"
15
16#include "ndn-cpp/fields/blob.h"
17#include "ndn-cpp/fields/key-locator.h"
18
19#include <string>
20
21namespace ndn {
22
23namespace signature {
24
25/**
26 * @brief Class providing operations to work with SHA256withRSA (OID: "2.16.840.1.101.3.4.2.1")
27 */
28class Sha256WithRsa : public virtual Signature
29{
30public:
31 /**
32 * @brief Virtual destructor
33 */
34 virtual
35 ~Sha256WithRsa ();
36
37 /**
38 * @brief Get OID of the signature algorithm
39 */
40 inline const std::string &
41 getDigestAlgorithm () const;
42
43 /**
44 * @brief Get reference to signature bits
45 */
46 inline Blob &
47 getSignatureBits ();
48
49 /**
50 * @brief Get const reference to signature bits
51 */
52 inline const Blob &
53 getSignatureBits () const;
54
55 /**
56 * @brief Set signature bits
57 */
58 inline void
59 setSignatureBits (const Blob &signatureBits);
60
61 /**
62 * @brief Get reference to publisher key digest bits
63 */
64 inline Blob &
65 getPublisherKeyDigest ();
66
67 /**
68 * @brief Get const reference to publisher key digest bits
69 */
70 inline const Blob &
71 getPublisherKeyDigest () const;
72
73 /**
74 * @brief Set publisher key digest bits
75 */
76 inline void
77 setPublisherKeyDigest (const Blob &publisherKeyDigest);
78
79 /**
80 * @brief Get reference to key locator object
81 */
82 inline KeyLocator &
83 getKeyLocator ();
84
85 /**
86 * @brief Get const reference to key locator object
87 */
88 inline const KeyLocator &
89 getKeyLocator () const;
90
91 /**
92 * @brief Set key locator object
93 */
94 inline void
95 setKeyLocator (const KeyLocator &keyLocator);
96
97 // from Signature
98 virtual void
99 doubleDispatch (std::ostream &os, wire::Base &wire, void *userData) const;
100
101private:
102 static const std::string s_oid;
103
104 Blob m_signatureBits;
105 Blob m_publisherKeyDigest;
106 KeyLocator m_keyLocator;
107};
108
109const std::string &
110Sha256WithRsa::getDigestAlgorithm () const
111{
112 return s_oid;
113}
114
115inline Blob &
116Sha256WithRsa::getSignatureBits ()
117{
118 return m_signatureBits;
119}
120
121inline const Blob &
122Sha256WithRsa::getSignatureBits () const
123{
124 return m_signatureBits;
125}
126
127inline void
128Sha256WithRsa::setSignatureBits (const Blob &signatureBits)
129{
130 m_signatureBits = signatureBits;
131}
132
133inline Blob &
134Sha256WithRsa::getPublisherKeyDigest ()
135{
136 return m_publisherKeyDigest;
137}
138
139inline const Blob &
140Sha256WithRsa::getPublisherKeyDigest () const
141{
142 return m_publisherKeyDigest;
143}
144
145inline void
146Sha256WithRsa::setPublisherKeyDigest (const Blob &publisherKeyDigest)
147{
148 m_publisherKeyDigest = publisherKeyDigest;
149}
150
151inline KeyLocator &
152Sha256WithRsa::getKeyLocator ()
153{
154 return m_keyLocator;
155}
156
157inline const KeyLocator &
158Sha256WithRsa::getKeyLocator () const
159{
160 return m_keyLocator;
161}
162
163inline void
164Sha256WithRsa::setKeyLocator (const KeyLocator &keyLocator)
165{
166 m_keyLocator = keyLocator;
167}
168
169} // signature
170} // ndn
171
172#endif // NDN_EXCLUDE_H