25 #include "../pib/key.hpp"    26 #include "../transform/buffer-source.hpp"    27 #include "../transform/digest-filter.hpp"    28 #include "../transform/stream-sink.hpp"    29 #include "../../encoding/buffer-stream.hpp"    30 #include "../../util/random.hpp"    41   return doHasKey(keyName);
    47   return doGetKeyHandle(keyName);
    58         BOOST_THROW_EXCEPTION(
Tpm::Error(
"Key `" + keyName.
toUri() + 
"` already exists"));
    74       const_cast<KeyParams&
>(params).setKeyId(keyId);
    78       BOOST_THROW_EXCEPTION(
Error(
"Unsupported key id type"));
    82   return doCreateKey(identity, params);
    95     BOOST_THROW_EXCEPTION(
Error(
"Key `" + keyName.
toUri() + 
"` does not exist"));
    97   return doExportKey(keyName, pw, pwLen);
   104     BOOST_THROW_EXCEPTION(
Error(
"Key `" + keyName.
toUri() + 
"` already exists"));
   106   doImportKey(keyName, pkcs8, pkcs8Len, pw, pwLen);
   134       BOOST_THROW_EXCEPTION(
Error(
"Unsupported key id type"));
 void setKeyName(const Name &keyName)
 
static Component fromNumber(uint64_t number)
Create a component encoded as nonNegativeInteger. 
 
Copyright (c) 2011-2015 Regents of the University of California. 
 
ConstBufferPtr derivePublicKey() const 
 
unique_ptr< KeyHandle > createKey(const Name &identity, const KeyParams ¶ms)
Create key for identity according to params. 
 
uint64_t generateSecureWord64()
Generate a cryptographically secure random integer from the range [0, 2^64) 
 
virtual void setTerminalMode(bool isTerminal) const 
Set the terminal mode of TPM. 
 
void importKey(const Name &keyName, const uint8_t *pkcs8, size_t pkcs8Len, const char *pw, size_t pwLen)
Import a private key in encrypted PKCS #8 format. 
 
void deleteKey(const Name &keyName)
Delete a key with name keyName. 
 
Abstraction of TPM key handle. 
 
virtual bool isTpmLocked() const 
 
Catch-all error for security policy errors that don't fit in other categories. 
 
std::string toUri() const 
Get URI representation of the name. 
 
ConstBufferPtr exportKey(const Name &keyName, const char *pw, size_t pwLen)
 
virtual bool isTerminalMode() const 
Check if TPM is in terminal mode. 
 
bool hasKey(const Name &keyName) const 
 
Use the SHA256 hash of the public key as the key id. 
 
Represents an absolute name. 
 
static void setKeyName(KeyHandle &keyHandle, const Name &identity, const KeyParams ¶ms)
Set the key name in keyHandle according to identity and params. 
 
virtual bool unlockTpm(const char *pw, size_t pwLen) const 
Unlock TPM. 
 
KeyIdType getKeyIdType() const 
 
unique_ptr< KeyHandle > getKeyHandle(const Name &keyName) const 
 
Component holds a read-only name component value. 
 
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer. 
 
Name constructKeyName(const Name &identity, const name::Component &keyId)
Construct key name based on the appropriate naming conventions. 
 
Use a 64-bit random number as the key id. 
 
Base class of key parameters. 
 
implements an output stream that constructs ndn::Buffer 
 
const name::Component & getKeyId() const 
 
shared_ptr< const Buffer > ConstBufferPtr