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