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 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 8 | #include "common.hpp" |
| 9 | #include <ndn-cxx/security/key-chain.hpp> |
| 10 | #include <ndn-cxx/face.hpp> |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 11 | |
| 12 | using namespace ndn; |
| 13 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 14 | int |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 15 | main() |
| 16 | { |
| 17 | Name root("/ndn"); |
| 18 | Name test("/ndn/test"); |
| 19 | Name alice("/ndn/test/alice"); |
| 20 | Name bob("/ndn/test/bob"); |
| 21 | Name cathy("/ndn/test/cathy"); |
| 22 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 23 | KeyChain keyChain("sqlite3", "file"); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 24 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 25 | if (!keyChain.doesIdentityExist(root) || |
| 26 | !keyChain.doesIdentityExist(test) || |
| 27 | !keyChain.doesIdentityExist(alice) || |
| 28 | !keyChain.doesIdentityExist(bob) || |
| 29 | !keyChain.doesIdentityExist(cathy)) |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 30 | return 1; |
| 31 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 32 | Face face; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 33 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 34 | face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(test))); |
| 35 | face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(alice))); |
| 36 | face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(bob))); |
| 37 | face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(cathy))); |
| 38 | |
| 39 | face.getIoService().run(); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 40 | } |