blob: 70501757f63b98aa2a672d90fd7f49302584b78e [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
Yingdi Yu0b0a7362014-08-05 16:31:30 -07008#include "common.hpp"
9#include <ndn-cxx/security/key-chain.hpp>
10#include <ndn-cxx/face.hpp>
Yingdi Yu348f5ea2014-03-01 14:47:25 -080011
12using namespace ndn;
13
Yingdi Yu0b0a7362014-08-05 16:31:30 -070014int
Yingdi Yu348f5ea2014-03-01 14:47:25 -080015main()
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 Yu0b0a7362014-08-05 16:31:30 -070023 KeyChain keyChain("sqlite3", "file");
Yingdi Yu348f5ea2014-03-01 14:47:25 -080024
Yingdi Yu0b0a7362014-08-05 16:31:30 -070025 if (!keyChain.doesIdentityExist(root) ||
26 !keyChain.doesIdentityExist(test) ||
27 !keyChain.doesIdentityExist(alice) ||
28 !keyChain.doesIdentityExist(bob) ||
29 !keyChain.doesIdentityExist(cathy))
Yingdi Yu348f5ea2014-03-01 14:47:25 -080030 return 1;
31
Yingdi Yu0b0a7362014-08-05 16:31:30 -070032 Face face;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080033
Yingdi Yu0b0a7362014-08-05 16:31:30 -070034 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 Yu348f5ea2014-03-01 14:47:25 -080040}