blob: bf4dfa621265517bf31e985ba7f9d4df45a3b442 [file] [log] [blame]
Jeff Thompson25b4e612013-10-10 16:03:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Jeff Thompson20af0732013-09-12 17:01:45 -07002/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07003 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson20af0732013-09-12 17:01:45 -07005 * See COPYING for copyright and distribution information.
6 */
7
Jeff Thompson25b4e612013-10-10 16:03:24 -07008#include "c/data.h"
9#include <ndn-cpp/sha256-with-rsa-signature.hpp>
Jeff Thompson20af0732013-09-12 17:01:45 -070010
11using namespace std;
Jeff Thompsond4144fe2013-09-18 15:59:57 -070012using namespace ndn::ptr_lib;
Jeff Thompson20af0732013-09-12 17:01:45 -070013
14namespace ndn {
15
Jeff Thompsond4144fe2013-09-18 15:59:57 -070016shared_ptr<Signature>
Jeff Thompson0050abe2013-09-17 12:50:25 -070017Sha256WithRsaSignature::clone() const
Jeff Thompson20af0732013-09-12 17:01:45 -070018{
Jeff Thompsond4144fe2013-09-18 15:59:57 -070019 return shared_ptr<Signature>(new Sha256WithRsaSignature(*this));
Jeff Thompson20af0732013-09-12 17:01:45 -070020}
21
Jeff Thompson0050abe2013-09-17 12:50:25 -070022void
23Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const
Jeff Thompson20af0732013-09-12 17:01:45 -070024{
Jeff Thompson93034532013-10-08 11:52:43 -070025 digestAlgorithm_.get(signatureStruct.digestAlgorithm);
26 witness_.get(signatureStruct.witness);
27 signature_.get(signatureStruct.signature);
Jeff Thompson20af0732013-09-12 17:01:45 -070028 publisherPublicKeyDigest_.get(signatureStruct.publisherPublicKeyDigest);
29 keyLocator_.get(signatureStruct.keyLocator);
30}
31
Jeff Thompson0050abe2013-09-17 12:50:25 -070032void
33Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct)
Jeff Thompson20af0732013-09-12 17:01:45 -070034{
Jeff Thompson93034532013-10-08 11:52:43 -070035 digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm);
36 witness_ = Blob(signatureStruct.witness);
37 signature_ = Blob(signatureStruct.signature);
Jeff Thompson20af0732013-09-12 17:01:45 -070038 publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest);
39 keyLocator_.set(signatureStruct.keyLocator);
40}
41
42}