blob: d3719a79272d287c816ae5b0a702755bb6868273 [file] [log] [blame]
Jeff Thompson958bf9b2013-10-12 17:20:51 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
Jeff Thompson173fd432013-10-12 18:16:41 -07004 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
Jeff Thompson958bf9b2013-10-12 17:20:51 -07005 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
Jeff Thompson258a4022013-10-15 17:43:58 -07009#if 1 // TODO: Remove this when we don't throw "not implemented".
10#include <stdexcept>
11#endif
Jeff Thompson958bf9b2013-10-12 17:20:51 -070012#include "../../encoding/der/der.hpp"
13#include <ndn-cpp/security/certificate/certificate-extension.hpp>
14
15using namespace std;
16using namespace ndn::ptr_lib;
17
18namespace ndn {
19
20shared_ptr<der::DerNode>
21CertificateExtension::toDer()
22{
Jeff Thompson84cfe1d2013-10-15 17:59:01 -070023#if 0 // Include again when der is defined.
Jeff Thompson958bf9b2013-10-12 17:20:51 -070024 shared_ptr<der::DerSequence> root(new der::DerSequence);
25
26 shared_ptr<der::DerOid> extensionId(new der::DerOid(extensionId_));
27 shared_ptr<der::DerBool> isCritical(new der::DerBool(isCritical_));
28 shared_ptr<der::DerOctetString> extensionValue(new der::DerOctetString(*extensionValue_));
29
30 root->addChild(extensionId);
31 root->addChild(isCritical);
32 root->addChild(extensionValue);
33
34 root->getSize();
35
36 return root;
Jeff Thompson84cfe1d2013-10-15 17:59:01 -070037#else
38 throw std::runtime_error("not implemented");
39#endif
Jeff Thompson958bf9b2013-10-12 17:20:51 -070040}
41
42Blob
43CertificateExtension::toDerBlob()
44{
45#if 0 // Need to convert blob_stream.
46 blob_stream blobStream;
47 ostream& start = reinterpret_cast<ostream&>(blobStream);
48
49 toDer()->encode(start);
50
51 return blobStream.buf();
52#else
53 throw std::runtime_error("not implemented");
54#endif
55}
56
57
58}