// // Key inquiries // void TokenDatabase::queryKeySizeInBits(Key &key, CssmKeySize &result) { Access access(token()); TRY GUARD access().queryKeySizeInBits(myKey(key).tokenHandle(), result); DONE }
// // Miscellaneous CSSM functions // void TokenDatabase::getOutputSize(const Context &context, Key &key, uint32 inputSize, bool encrypt, uint32 &result) { Access access(token()); TRY GUARD access().getOutputSize(context, myKey(key).tokenHandle(), inputSize, encrypt, result); DONE }
void TokenDatabase::verifySignature(const Context &context, Key &key, CSSM_ALGORITHMS verifyOnlyAlgorithm, const CssmData &data, const CssmData &signature) { Access access(token(), key); TRY GUARD access().verifySignature(context, myKey(key).tokenHandle(), data, signature, verifyOnlyAlgorithm); DONE }
void TokenDatabase::decrypt(const Context &context, Key &key, const CssmData &cipher, CssmData &clear) { Access access(token()); TRY key.validate(CSSM_ACL_AUTHORIZATION_DECRYPT, context); GUARD access().decrypt(context, myKey(key).tokenHandle(), cipher, clear); DONE }
void TokenDatabase::verifyMac(const Context &context, Key &key, const CssmData &data, const CssmData &mac) { Access access(token()); TRY key.validate(CSSM_ACL_AUTHORIZATION_MAC, context); GUARD access().verifyMac(context, myKey(key).tokenHandle(), data, mac); DONE }
// // Signatures and MACs // void TokenDatabase::generateSignature(const Context &context, Key &key, CSSM_ALGORITHMS signOnlyAlgorithm, const CssmData &data, CssmData &signature) { Access access(token(), key); TRY key.validate(CSSM_ACL_AUTHORIZATION_SIGN, context); GUARD access().generateSignature(context, myKey(key).tokenHandle(), data, signature, signOnlyAlgorithm); DONE }
void MaterialObject::build() { check(); if (!debugInactivate_()) { // for (auto& currentSensor : sensorNode_) { // ReferenceSensor temporarySensor; // temporarySensor.store(currentSensor.second); // temporarySensor.check(); // temporarySensor.cleanup(); // std::cout << "[" << currentSensor.first << "]=" << temporarySensor.numChannels() << "; "; // sensorChannels[currentSensor.first] = temporarySensor.numChannels(); // } // std::cout << "}" << std::endl; static std::map<MaterialObjectKey, Materials*> materialsMap_; //for saving memory for (auto& currentMaterialNode : materialsNode_) { store(currentMaterialNode.second); check(); if (type_().compare(getTypeString()) == 0) { MaterialObjectKey myKey(currentMaterialNode.first, sensorChannels, destination_.state()? destination_() : std::string("")); if (materialsMap_.count(myKey) == 0) { Materials * newMaterials = new Materials(materialType_); newMaterials->store(currentMaterialNode.second); //pass destination to newMaterials if(destination_.state()) { PropertyTree destinationPt; destinationPt.add(destination_.name(), destination_()); newMaterials->store(destinationPt); } newMaterials->build(sensorChannels); materialsMap_[myKey] = newMaterials; } materials_ = materialsMap_[myKey]; break; } } } cleanup(); }
void KeyboardCB(unsigned char key, int x, int y) { switch (key) { case 'q': case 27: exit(0); case 'f': // take a snapshot in ppm format g_frameSaver.DumpPPM(g_width,g_height) ; break; case 't': resetTime() ; break ; case 'r': resetArcball() ; Reset() ; g_zoom = 1 ; glutPostRedisplay() ; break ; case 'a': // toggle animation state if( g_state == STATE_ANIMATE ) { g_state = STATE_IDLE ; } else { resetTime() ; g_state = STATE_ANIMATE ; } break ; case 's': // togle simulation state if( g_state == STATE_SIMULATE ) { g_state = STATE_IDLE ; } else { resetTime() ; InitSimulation() ; g_state = STATE_SIMULATE ; } break ; case 'p': // togle playback if( g_state == STATE_PLAYBACK ) { g_state = STATE_IDLE ; } else { g_state = STATE_PLAYBACK ; } break ; case '0': //reset your object break ; case 'm': // toggle frame dumping if( g_frameDumping == 1 ) { animTcl::OutputMessage("Frame Frame Dumping disabled.\n") ; g_frameDumping = 0 ; } else { animTcl::OutputMessage("Frame Frame Dumping enabled.\n") ; g_frameDumping = 1 ; } g_frameSaver.Toggle(g_width); break ; case 'h': case '?': instructions(); break; } myKey(key, x, y) ; glutPostRedisplay() ; }