Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 1 | /* -*- 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 | |
| 11 | using namespace ndn; |
| 12 | |
| 13 | int |
| 14 | main() |
| 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 | } |