/** * Save the key data in a JSON like format. The filename is specified in * constructor YubikoOtpKeyConfig::YubikoOtpKeyConfig(const string& ) */ void YubikoOtpKeyConfig::save() { BOOST_LOG_NAMED_SCOPE("YubikoOtpKeyConfig::save"); const string myOutFile = checkFileName(true); ptree myTree; myTree.put(K_NM_DOC_PRIV_ID /*--->*/, getPrivateId()); myTree.put(K_NM_DOC_PUB_ID /*---->*/, getPublicId()); myTree.put(K_NM_DOC_SEC_KEY /*--->*/, getSecretKey()); myTree.put(K_NM_DOC_TIMESTAMP /*->*/, getTimestamp().tstp_int); myTree.put(K_NM_DOC_SES_CNTR /*-->*/, getCounter()); myTree.put(K_NM_DOC_CRC /*------->*/, getCrc()); myTree.put(K_NM_DOC_RANDOM /*---->*/, getRandom()); myTree.put(K_NM_DOC_USE_CNTR /*-->*/, getUseCounter()); myTree.put(K_NM_DOC_DESC /*------>*/, getDescription()); myTree.put(K_NM_DOC_SYS_USER /*-->*/, getSysUser()); myTree.put(K_NM_DOC_VERS /*------>*/, K_VL_VERS); write_json(myOutFile, myTree); itsChangedFlag = false; }
/** * @return The public ID encoded in Modhex mode. */ const string YubikoOtpKeyConfig::getPublicIdModhex() const { return hex2Modhex(getPublicId()); }
bool DOMDocumentTypeImpl::isEqualNode(const DOMNode* arg) const { if (isSameNode(arg)) { return true; } if (!fNode.isEqualNode(arg)) { return false; } DOMDocumentType* argDT = (DOMDocumentType*) arg; // check the string values if (!getPublicId()) { if (argDT->getPublicId()) { return false; } } else if (!XMLString::equals(getPublicId(), argDT->getPublicId())) { return false; } if (!getSystemId()) { if (argDT->getSystemId()) { return false; } } else if (!XMLString::equals(getSystemId(), argDT->getSystemId())) { return false; } if (!getInternalSubset()) { if (argDT->getInternalSubset()) { return false; } } else if (!XMLString::equals(getInternalSubset(), argDT->getInternalSubset())) { return false; } // check the notations if (getNotations()) { if (!argDT->getNotations()) return false; DOMNamedNodeMap* map1 = getNotations(); DOMNamedNodeMap* map2 = argDT->getNotations(); XMLSize_t len = map1->getLength(); if (len != map2->getLength()) { return false; } for (XMLSize_t i = 0; i < len; i++) { DOMNode* n1 = map1->item(i); DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); if (!n2 || !n1->isEqualNode(n2)) { return false; } } } else { if (argDT->getNotations()) return false; } // check the entities if (getEntities()) { if (!argDT->getEntities()) return false; DOMNamedNodeMap* map1 = getEntities(); DOMNamedNodeMap* map2 = argDT->getEntities(); XMLSize_t len = map1->getLength(); if (len != map2->getLength()) { return false; } for (XMLSize_t i = 0; i < len; i++) { DOMNode* n1 = map1->item(i); DOMNode* n2 = map2->getNamedItem(n1->getNodeName()); if (!n2 || !n1->isEqualNode(n2)) { return false; } } } else { if (argDT->getEntities()) return false; } return fParent.isEqualNode(arg); }