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; |
| 12 | |
| 13 | namespace ndn { |
| 14 | |
Jeff Thompson | ce11576 | 2013-12-18 14:59:56 -0800 | [diff] [blame^] | 15 | ptr_lib::shared_ptr<Signature> |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 16 | Sha256WithRsaSignature::clone() const |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 17 | { |
Jeff Thompson | ce11576 | 2013-12-18 14:59:56 -0800 | [diff] [blame^] | 18 | return ptr_lib::shared_ptr<Signature>(new Sha256WithRsaSignature(*this)); |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 19 | } |
| 20 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 21 | void |
| 22 | Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 23 | { |
Jeff Thompson | 9303453 | 2013-10-08 11:52:43 -0700 | [diff] [blame] | 24 | digestAlgorithm_.get(signatureStruct.digestAlgorithm); |
| 25 | witness_.get(signatureStruct.witness); |
| 26 | signature_.get(signatureStruct.signature); |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 27 | publisherPublicKeyDigest_.get(signatureStruct.publisherPublicKeyDigest); |
| 28 | keyLocator_.get(signatureStruct.keyLocator); |
| 29 | } |
| 30 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 31 | void |
| 32 | Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct) |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 33 | { |
Jeff Thompson | 9303453 | 2013-10-08 11:52:43 -0700 | [diff] [blame] | 34 | digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm); |
| 35 | witness_ = Blob(signatureStruct.witness); |
| 36 | signature_ = Blob(signatureStruct.signature); |
Jeff Thompson | 20af073 | 2013-09-12 17:01:45 -0700 | [diff] [blame] | 37 | publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest); |
| 38 | keyLocator_.set(signatureStruct.keyLocator); |
| 39 | } |
| 40 | |
| 41 | } |