blob: 3153551967860bc78db457d4b34f4582ff7154ee [file] [log] [blame]
Jeff Thompson20af0732013-09-12 17:01:45 -07001/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07002 * Copyright (C) 2013 Regents of the University of California.
3 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson20af0732013-09-12 17:01:45 -07004 * See COPYING for copyright and distribution information.
5 */
6
7#include "sha256-with-rsa-signature.hpp"
8
9using namespace std;
Jeff Thompsond4144fe2013-09-18 15:59:57 -070010using namespace ndn::ptr_lib;
Jeff Thompson20af0732013-09-12 17:01:45 -070011
12namespace ndn {
13
Jeff Thompsond4144fe2013-09-18 15:59:57 -070014shared_ptr<Signature>
Jeff Thompson0050abe2013-09-17 12:50:25 -070015Sha256WithRsaSignature::clone() const
Jeff Thompson20af0732013-09-12 17:01:45 -070016{
Jeff Thompsond4144fe2013-09-18 15:59:57 -070017 return shared_ptr<Signature>(new Sha256WithRsaSignature(*this));
Jeff Thompson20af0732013-09-12 17:01:45 -070018}
19
Jeff Thompson0050abe2013-09-17 12:50:25 -070020void
21Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const
Jeff Thompson20af0732013-09-12 17:01:45 -070022{
Jeff Thompson93034532013-10-08 11:52:43 -070023 digestAlgorithm_.get(signatureStruct.digestAlgorithm);
24 witness_.get(signatureStruct.witness);
25 signature_.get(signatureStruct.signature);
Jeff Thompson20af0732013-09-12 17:01:45 -070026 publisherPublicKeyDigest_.get(signatureStruct.publisherPublicKeyDigest);
27 keyLocator_.get(signatureStruct.keyLocator);
28}
29
Jeff Thompson0050abe2013-09-17 12:50:25 -070030void
31Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct)
Jeff Thompson20af0732013-09-12 17:01:45 -070032{
Jeff Thompson93034532013-10-08 11:52:43 -070033 digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm);
34 witness_ = Blob(signatureStruct.witness);
35 signature_ = Blob(signatureStruct.signature);
Jeff Thompson20af0732013-09-12 17:01:45 -070036 publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest);
37 keyLocator_.set(signatureStruct.keyLocator);
38}
39
40}