当前位置: 首页>>代码示例>>C++>>正文


C++ Name::toUri方法代码示例

本文整理汇总了C++中Name::toUri方法的典型用法代码示例。如果您正苦于以下问题:C++ Name::toUri方法的具体用法?C++ Name::toUri怎么用?C++ Name::toUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Name的用法示例。


在下文中一共展示了Name::toUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ConstBufferPtr

Block 
SecTpmMemory::signInTpm(const uint8_t *data, size_t dataLength,
                const Name& keyName,
                DigestAlgorithm digestAlgorithm)
{
  if (digestAlgorithm != DIGEST_ALGORITHM_SHA256)
    return ConstBufferPtr();

  // Find the private key and sign.
  PrivateKeyStore::iterator privateKey = privateKeyStore_.find(keyName.toUri());
  if (privateKey == privateKeyStore_.end())
    throw Error(string("MemoryPrivateKeyStorage: Cannot find private key ") + keyName.toUri());
  
  uint8_t digest[SHA256_DIGEST_LENGTH];
  SHA256_CTX sha256;
  SHA256_Init(&sha256);
  SHA256_Update(&sha256, data, dataLength);
  SHA256_Final(digest, &sha256);

  BufferPtr signatureBuffer = ptr_lib::make_shared<Buffer>();
  signatureBuffer->resize(RSA_size(privateKey->second->getPrivateKey()));
  
  unsigned int signatureBitsLength;  
  if (!RSA_sign(NID_sha256, digest, sizeof(digest),
                signatureBuffer->buf(),
                &signatureBitsLength,
                privateKey->second->getPrivateKey()))
    {
      throw Error("Error in RSA_sign");
    }

  return Block(Tlv::SignatureValue, signatureBuffer);
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: QString

void
ChatDialog::updateLabels(Name newChatPrefix)
{
  // Reset DigestTree
  m_scene->clearAll();
  m_scene->plot("Empty");

  // Display chatroom name
  QString chatroomName = QString("Chatroom: %1").arg(QString::fromStdString(m_chatroomName));
  ui->infoLabel->setStyleSheet("QLabel {color: #630; font-size: 16px; font: bold \"Verdana\";}");
  ui->infoLabel->setText(chatroomName);

  // Display chat message prefix
  QString chatPrefix;
  if (PRIVATE_PREFIX.isPrefixOf(newChatPrefix)) {
    chatPrefix =
      QString("<Warning: no connection to hub or hub does not support prefix autoconfig.>\n"
              "<Prefix = %1>")
      .arg(QString::fromStdString(newChatPrefix.toUri()));
    ui->prefixLabel->setStyleSheet(
      "QLabel {color: red; font-size: 12px; font: bold \"Verdana\";}");
  }
  else {
    chatPrefix = QString("<Prefix = %1>")
      .arg(QString::fromStdString(newChatPrefix.toUri()));
    ui->prefixLabel->setStyleSheet(
      "QLabel {color: Green; font-size: 12px; font: bold \"Verdana\";}");
  }
  ui->prefixLabel->setText(chatPrefix);
  fitView();
}
开发者ID:bruinfish,项目名称:ChronoChat,代码行数:31,代码来源:chat-dialog.cpp

示例3: producerSatisfiedAuthRequest

 void producerSatisfiedAuthRequest( const Name& producer_name,
                                    const Name& request_name,
                                    const NdnParameterSet& credentials )
 {
       if( logging_enabled )
       {
           lock.lock();
           log_file << "Producer:SatisfiedAuth" << endl
                    << "{" << endl
                    << "    time     = " <<  time::system_clock::now() << endl
                    << "    producer = " << producer_name.toUri() << endl
                    << "    request  = " << request_name.toUri() << endl
                    << "    username = " <<
                               ( ( credentials.hasParameter( "username" ) )
                                 ? credentials.getParameter( "username" )
                                 : "none" )
                               << endl
                    << "    password = " <<
                               ( ( credentials.hasParameter( "password" ) )
                                 ? credentials.getParameter( "password" )
                                 : "none" )
                               << endl
                    << "}" << endl;
            lock.unlock();
        }
 }
开发者ID:raystubbs,项目名称:NMSU-BigData-REU-NDN-Access-Control-Simulation,代码行数:26,代码来源:Coordinator.cpp

示例4: idString

Name
IdentityCertificate::certificateNameToPublicKeyName(const Name& certificateName)
{
  int i = certificateName.size() - 1;
  string idString("ID-CERT");
  bool foundIdString = false;
  for (; i >= 0; i--) {
    if (certificateName.get(i).toEscapedString() == idString)
      {
        foundIdString = true;
        break;
      }
  }

  if(!foundIdString)
    throw Error("Incorrect identity certificate name " + certificateName.toUri());
    
  Name tmpName = certificateName.getSubName(0, i);    
  string keyString("KEY");
  bool foundKeyString = false;
  for (i = 0; i < tmpName.size(); i++) {
    if (tmpName.get(i).toEscapedString() == keyString)
      {
        foundKeyString = true;
        break;
      }
  }

  if(!foundKeyString)
    throw Error("Incorrect identity certificate name " + certificateName.toUri());
  
  return tmpName.getSubName(0, i).append(tmpName.getSubName(i + 1, tmpName.size() - i - 1));
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例5: Error

ptr_lib::shared_ptr<PublicKey> 
SecTpmMemory::getPublicKeyFromTpm(const Name& keyName)
{
  PublicKeyStore::iterator publicKey = publicKeyStore_.find(keyName.toUri());
  if (publicKey == publicKeyStore_.end())
    throw Error(string("MemoryPrivateKeyStorage: Cannot find public key ") + keyName.toUri());
  return publicKey->second;
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例6:

void
SecTpmMemory::setKeyPairForKeyName(const Name& keyName,
                                uint8_t *publicKeyDer, size_t publicKeyDerLength,
                                uint8_t *privateKeyDer, size_t privateKeyDerLength)
{
  publicKeyStore_[keyName.toUri()]  = ptr_lib::make_shared<PublicKey>(publicKeyDer, publicKeyDerLength);
  privateKeyStore_[keyName.toUri()] = ptr_lib::make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例7: Error

shared_ptr<IdentityCertificate>
SecPublicInfoMemory::getCertificate(const Name& certificateName)
{
  CertificateStore::iterator record = m_certificateStore.find(certificateName.toUri());
  if (record == m_certificateStore.end())
    throw Error("SecPublicInfoMemory::getCertificate  " + certificateName.toUri());

  return record->second;
}
开发者ID:PatrickGuo,项目名称:ndn-cxx-master,代码行数:9,代码来源:sec-public-info-memory.cpp

示例8: if

bool
SecTpmMemory::doesKeyExistInTpm(const Name& keyName, KeyClass keyClass)
{
  if (keyClass == KEY_CLASS_PUBLIC)
    return publicKeyStore_.find(keyName.toUri()) != publicKeyStore_.end();
  else if (keyClass == KEY_CLASS_PRIVATE)
    return privateKeyStore_.find(keyName.toUri()) != privateKeyStore_.end();
  else
    // KEY_CLASS_SYMMETRIC not implemented yet.
    return false;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9: publicKeyPath

void
SecTpmFile::deleteKeyPairInTpm(const Name& keyName)
{
  boost::filesystem::path publicKeyPath(m_impl->transformName(keyName.toUri(), ".pub"));
  boost::filesystem::path privateKeyPath(m_impl->transformName(keyName.toUri(), ".pri"));

  if (boost::filesystem::exists(publicKeyPath))
    boost::filesystem::remove(publicKeyPath);

  if (boost::filesystem::exists(privateKeyPath))
    boost::filesystem::remove(privateKeyPath);
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:12,代码来源:sec-tpm-file.cpp

示例10: Name

shared_ptr<Data> StorageEngineImpl::read(const Interest &interest)
{
    shared_ptr<Data> data;
#if HAVE_PERSISTENT_STORAGE
    bool canBePrefix = interest.getCanBePrefix();

    if (canBePrefix)
    {
        // extract by prefix match
        Name prefix = interest.getName(), keyName;
        auto it = db_->NewIterator(db_namespace::ReadOptions());
        std::string key = "";
        bool checkMaxSuffixComponents = interest.getMaxSuffixComponents() != -1;
        bool checkMinSuffixComponents = interest.getMinSuffixComponents() != -1;

        for (it->Seek(prefix.toUri());
             it->Valid() && it->key().starts_with(prefix.toUri());
             it->Next())
        {
            if (checkMaxSuffixComponents || checkMinSuffixComponents)
            {
                keyName = Name(it->key().ToString());
                int nSuffixComponents = keyName.size() - prefix.size();
                bool passCheck = false;

                if (checkMaxSuffixComponents && 
                    nSuffixComponents <= interest.getMaxSuffixComponents())
                    passCheck = true;
                if (checkMinSuffixComponents &&
                    nSuffixComponents >= interest.getMinSuffixComponents())
                    passCheck = true;
                
                if (passCheck)
                    key = it->key().ToString();
            }
            else
                key = it->key().ToString();
        }

        if (key != "")
            data = get(Name(key));

        delete it;
    }
    else
        data =  get(interest.getName());
#endif
    return data;
}
开发者ID:remap,项目名称:ndnrtc,代码行数:49,代码来源:storage-engine.cpp

示例11: producerSatisfiedRequest

 void producerSatisfiedRequest( const Name& producer_name,
                                const Name& request_name )
 {
       if( logging_enabled )
       {
           lock.lock();
           log_file << "Producer:Satisfied" << endl
                    << "{" << endl
                    << "    time     = " <<  time::system_clock::now() << endl
                    << "    producer = " << producer_name.toUri() << endl
                    << "    request  = " << request_name.toUri() << endl
                    << "}" << endl;
            lock.unlock();
        }
 }
开发者ID:raystubbs,项目名称:NMSU-BigData-REU-NDN-Access-Control-Simulation,代码行数:15,代码来源:Coordinator.cpp

示例12:

bool
SecTpmFile::doesKeyExistInTpm(const Name& keyName, KeyClass keyClass)
{
  string keyURI = keyName.toUri();
  if (keyClass == KEY_CLASS_PUBLIC)
    {
      if (boost::filesystem::exists(m_impl->transformName(keyURI, ".pub")))
        return true;
      else
        return false;
    }
  if (keyClass == KEY_CLASS_PRIVATE)
    {
      if (boost::filesystem::exists(m_impl->transformName(keyURI, ".pri")))
        return true;
      else
        return false;
    }
  if (keyClass == KEY_CLASS_SYMMETRIC)
    {
      if (boost::filesystem::exists(m_impl->transformName(keyURI, ".key")))
        return true;
      else
        return false;
    }
  return false;
}
开发者ID:JianpengWang,项目名称:ndn-cxx,代码行数:27,代码来源:sec-tpm-file.cpp

示例13: namespace

void
MulticastDiscovery::onSetStrategyFailure(const std::string& error)
{
  m_nextStageOnFailure("Failed to set multicast strategy for " +
                       LOCALHOP_HUB_DISCOVERY_PREFIX.toUri() + " namespace (" + error + "). "
                       "Skipping multicast discovery stage");
}
开发者ID:MobinRanjbar,项目名称:NFD,代码行数:7,代码来源:multicast-discovery.cpp

示例14: remove

void
FilePrivateKeyStorage::deleteKeyPair(const Name& keyName)
{
  string keyUri = keyName.toUri();

  remove(nameTransform(keyUri, ".pub").c_str());
  remove(nameTransform(keyUri, ".pri").c_str());
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例15: Error

void
SecPublicInfoMemory::addIdentity(const Name& identityName)
{
  string identityUri = identityName.toUri();
  if (find(identityStore_.begin(), identityStore_.end(), identityUri) != identityStore_.end())
    throw Error("Identity already exists: " + identityUri);
  
  identityStore_.push_back(identityUri);
}
开发者ID:ltr120,项目名称:ndn-cpp,代码行数:9,代码来源:sec-public-info-memory.cpp


注:本文中的Name::toUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。