blob: 898d792b2e1e0981832e52c28feb91f27a44b62d [file] [log] [blame]
Jeff Thompsonfa306642013-06-17 15:06:57 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Alexander Afanasyev
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
9 */
10
11#ifndef NDN_KEYCHAIN_PKCS12_H
12#define NDN_KEYCHAIN_PKCS12_H
13
14#include "keychain.h"
15#include "ndn-cpp/helpers/hash.h"
16
17namespace ndn
18{
19
20/**
21 * @brief Class implementing logic to work with pkcs12 CCNx keystore file (.ccnx_keystore)
22 */
23class KeychainKeystoreOpenssl : public virtual Keychain
24{
25public:
26 KeychainKeystoreOpenssl ();
27 KeychainKeystoreOpenssl (const std::string &path);
28
29public:
30 /////////////////////////////////////////////////////
31 // interface to manage certificates and identities //
32 /////////////////////////////////////////////////////
33
34 virtual Ptr<const Identity>
35 getDefaultIdentity ();
36
37 virtual Ptr<const Identity>
38 getIdentity (const Name &identityName);
39
40 virtual Ptr<const Identity>
41 generateIdentity (const Name &identityName);
42
43 virtual void
44 requestIdentityCertificate (const Identity &identity, std::ostream &os);
45
46 virtual Ptr<const Certificate>
47 issueCertificate (const Identity &identity, std::istream &is);
48
49 virtual Ptr<const Certificate>
50 issueCertificate (std::istream &is);
51
52 virtual void
53 installIdentityCertificate (const Certificate &cert);
54
55public:
56 /////////////////////////////////////////////////////
57 // interface to sign and encrypt data //
58 /////////////////////////////////////////////////////
59 virtual Ptr<Signature>
60 sign (const Identity &identity, const void *buffer, size_t size);
61
62
63private:
64 void
65 initialize (const std::string &pkcs12);
66
67private:
68 Name m_publicKeyName;
69 Hash m_publicKeyDigest;
70};
71
72} // ndn
73
74#endif // NDN_KEYCHAIN_KEYSTORE_OPENSSL_H