blob: 87e4e6c594fd8ae652f83286328c410a47cdccbb [file] [log] [blame]
Jeff Thompson415da1e2013-10-17 16:52:59 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
9#include "simple-visitor.hpp"
10#include <ndn-cpp/security/certificate/public-key.hpp>
11#include "../der.hpp"
12#include "public-key-visitor.hpp"
13
14using namespace std;
15using namespace ndn::ptr_lib;
16
17namespace ndn {
18
19namespace der {
20
21ndnboost::any
22PublicKeyVisitor::visit(DerSequence& derSeq)
23{
24 const DerNodePtrList& children = derSeq.getChildren();
25
26 SimpleVisitor simpleVisitor;
27 shared_ptr<DerSequence> algoSeq = dynamic_pointer_cast<DerSequence>(children[0]);
28 OID algorithm = ndnboost::any_cast<OID>(algoSeq->getChildren()[0]->accept(simpleVisitor));
29 Blob raw = derSeq.getRaw();
30 return ndnboost::any(shared_ptr<PublicKey>(new PublicKey(algorithm, raw)));
31}
32
33} // der
34
35}