Yingdi Yu | 233a972 | 2014-03-07 15:47:09 -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 | 233a972 | 2014-03-07 15:47:09 -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 | 233a972 | 2014-03-07 15:47:09 -0800 | [diff] [blame] | 15 | main() |
| 16 | { |
| 17 | Name root("/ndn"); |
| 18 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame^] | 19 | KeyChain keyChain("sqlite3", "file"); |
Yingdi Yu | 233a972 | 2014-03-07 15:47:09 -0800 | [diff] [blame] | 20 | |
| 21 | if(!keyChain.doesIdentityExist(root)) |
| 22 | return 1; |
| 23 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame^] | 24 | Face face; |
Yingdi Yu | 233a972 | 2014-03-07 15:47:09 -0800 | [diff] [blame] | 25 | |
| 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 Yu | 233a972 | 2014-03-07 15:47:09 -0800 | [diff] [blame] | 33 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame^] | 34 | face.put(data); |
| 35 | |
| 36 | face.getIoService().run(); |
Yingdi Yu | 233a972 | 2014-03-07 15:47:09 -0800 | [diff] [blame] | 37 | } |