blob: ccf02303e2f402baf7a61acef8185b8a0f0a1962 [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;
12
13namespace ndn {
14
Jeff Thompsonce115762013-12-18 14:59:56 -080015ptr_lib::shared_ptr<Signature>
Jeff Thompson0050abe2013-09-17 12:50:25 -070016Sha256WithRsaSignature::clone() const
Jeff Thompson20af0732013-09-12 17:01:45 -070017{
Jeff Thompsonce115762013-12-18 14:59:56 -080018 return ptr_lib::shared_ptr<Signature>(new Sha256WithRsaSignature(*this));
Jeff Thompson20af0732013-09-12 17:01:45 -070019}
20
Jeff Thompson0050abe2013-09-17 12:50:25 -070021void
22Sha256WithRsaSignature::get(struct ndn_Signature& signatureStruct) const
Jeff Thompson20af0732013-09-12 17:01:45 -070023{
Jeff Thompson93034532013-10-08 11:52:43 -070024 digestAlgorithm_.get(signatureStruct.digestAlgorithm);
25 witness_.get(signatureStruct.witness);
26 signature_.get(signatureStruct.signature);
Jeff Thompson20af0732013-09-12 17:01:45 -070027 publisherPublicKeyDigest_.get(signatureStruct.publisherPublicKeyDigest);
28 keyLocator_.get(signatureStruct.keyLocator);
29}
30
Jeff Thompson0050abe2013-09-17 12:50:25 -070031void
32Sha256WithRsaSignature::set(const struct ndn_Signature& signatureStruct)
Jeff Thompson20af0732013-09-12 17:01:45 -070033{
Jeff Thompson93034532013-10-08 11:52:43 -070034 digestAlgorithm_ = Blob(signatureStruct.digestAlgorithm);
35 witness_ = Blob(signatureStruct.witness);
36 signature_ = Blob(signatureStruct.signature);
Jeff Thompson20af0732013-09-12 17:01:45 -070037 publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest);
38 keyLocator_.set(signatureStruct.keyLocator);
39}
40
41}