blob: 602294050e3063149503db7fbc407a12b59ce51c [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -08001/* -*- 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 * See COPYING for copyright and distribution information.
6 */
7
8#include <ndn-cpp-dev/security/key-chain.hpp>
9#include <ndn-cpp-dev/face.hpp>
10
11using namespace ndn;
12
13int
14main()
15{
16 Name root("/ndn");
17 Name test("/ndn/test");
18 Name alice("/ndn/test/alice");
19 Name bob("/ndn/test/bob");
20 Name cathy("/ndn/test/cathy");
21
22 KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
23
24 if(!keyChain.doesIdentityExist(root)
25 || !keyChain.doesIdentityExist(test)
26 || !keyChain.doesIdentityExist(alice)
27 || !keyChain.doesIdentityExist(bob)
28 || !keyChain.doesIdentityExist(cathy))
29 return 1;
30
31 shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
32 shared_ptr<Face> face = shared_ptr<Face>(new Face(ioService));
33 // shared_ptr<Face> face = make_shared<Face>();
34
35 face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(test)));
36 face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(alice)));
37 face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(bob)));
38 face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(cathy)));
39
40 ioService->run();
41}