Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 2 | /** |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 8 | #include "c/data.h" |
| 9 | #include <ndn-cpp/sha256-with-rsa-signature.hpp> |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 10 | |
| 11 | using namespace std; |
Jeff Thompson | d4144fe | 2013-09-18 15:59:57 -0700 | [diff] [blame] | 12 | using namespace ndn::ptr_lib; |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 13 | |
| 14 | namespace ndn { |
| 15 | |
Jeff Thompson | d4144fe | 2013-09-18 15:59:57 -0700 | [diff] [blame] | 16 | shared_ptr<Signature> |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 17 | Sha256WithRsaSignature::clone() const |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 18 | { |
Jeff Thompson | d4144fe | 2013-09-18 15:59:57 -0700 | [diff] [blame] | 19 | return shared_ptr<Signature>(new Sha256WithRsaSignature(*this)); |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 20 | } |
| 21 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 22 | void |
| 23 | Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 24 | { |
Jeff Thompson | 9303453 | 2013-10-08 11:52:43 -0700 | [diff] [blame] | 25 | digestAlgorithm_.get(signatureStruct.digestAlgorithm); |
| 26 | witness_.get(signatureStruct.witness); |
| 27 | signature_.get(signatureStruct.signature); |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 28 | publisherPublicKeyDigest_.get(signatureStruct.publisherPublicKeyDigest); |
| 29 | keyLocator_.get(signatureStruct.keyLocator); |
| 30 | } |
| 31 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 32 | void |
| 33 | Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct) |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 34 | { |
Jeff Thompson | 9303453 | 2013-10-08 11:52:43 -0700 | [diff] [blame] | 35 | digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm); |
| 36 | witness_ = Blob(signatureStruct.witness); |
| 37 | signature_ = Blob(signatureStruct.signature); |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 38 | publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest); |
| 39 | keyLocator_.set(signatureStruct.keyLocator); |
| 40 | } |
| 41 | |
| 42 | } |