blob: 7f3af3fb3dcecdc483719620500b33c9e6a525fd [file] [log] [blame]
Yingdi Yu233a9722014-03-07 15:47:09 -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 Yu233a9722014-03-07 15:47:09 -080011
12using namespace ndn;
13
Yingdi Yu0b0a7362014-08-05 16:31:30 -070014int
Yingdi Yu233a9722014-03-07 15:47:09 -080015main()
16{
17 Name root("/ndn");
18
Yingdi Yu0b0a7362014-08-05 16:31:30 -070019 KeyChain keyChain("sqlite3", "file");
Yingdi Yu233a9722014-03-07 15:47:09 -080020
21 if(!keyChain.doesIdentityExist(root))
22 return 1;
23
Yingdi Yu0b0a7362014-08-05 16:31:30 -070024 Face face;
Yingdi Yu233a9722014-03-07 15:47:09 -080025
26 Name name("/local/ndn/prefix");
27 name.appendVersion().appendSegment(0);
28
29 Data data(name);
30 std::string prefix("/ndn/test");
31 data.setContent(reinterpret_cast<const uint8_t*>(prefix.c_str()), prefix.size());
32 keyChain.signByIdentity(data, root);
Yingdi Yu233a9722014-03-07 15:47:09 -080033
Yingdi Yu0b0a7362014-08-05 16:31:30 -070034 face.put(data);
35
36 face.getIoService().run();
Yingdi Yu233a9722014-03-07 15:47:09 -080037}