blob: d5b6e3e79d7e730df372d75906fd979f72f5b498 [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{
Jeff Thompson3d5096c2013-12-11 16:40:05 -080024 DerNodePtrList& children = derSeq.getChildren();
Jeff Thompson415da1e2013-10-17 16:52:59 -070025
26 SimpleVisitor simpleVisitor;
Jeff Thompson3d5096c2013-12-11 16:40:05 -080027 shared_ptr<DerSequence> algoSeq = static_cast<shared_ptr<DerSequence> >(children[0]);
Jeff Thompson415da1e2013-10-17 16:52:59 -070028 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}