//generates a <secret , public> / Pedersen commitment but takes bH as input tuple<ctkey, ctkey> ctskpkGen(key bH) { ctkey sk, pk; skpkGen(sk.dest, pk.dest); skpkGen(sk.mask, pk.mask); addKeys(pk.mask, pk.mask, bH); return make_tuple(sk, pk); }
void KeyAddDialog::addFile() { QString file = QFileDialog::getOpenFileName( this, windowTitle(), QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation ), tr("Certificates (*.pem *.cer *.crt)") ); if( file.isEmpty() ) return; QFile f( file ); if( !f.open( QIODevice::ReadOnly ) ) { QMessageBox::warning( this, windowTitle(), tr("Failed to open certifiacte") ); return; } CKey k( QSslCertificate( &f, QSsl::Pem ) ); if( k.cert.isNull() ) { f.reset(); k.setCert( QSslCertificate( &f, QSsl::Der ) ); } if( k.cert.isNull() ) { QMessageBox::warning( this, windowTitle(), tr("Failed to read certificate") ); } else if( !SslCertificate( k.cert ).keyUsage().contains( SslCertificate::DataEncipherment ) ) { QMessageBox::warning( this, windowTitle(), tr("This certificate is not usable for crypting") ); } else addKeys( QList<CKey>() << k ); f.close(); }
MockInputDeviceNode* getAsusGamepad() { auto node = new MockInputDeviceNode(); node->setPath("/dev/input/event3"); node->setName("ASUS Gamepad"); // Location not set node->setUniqueId("C5:30:CD:50:A0:54"); node->setBusType(0x0005); node->setVendorId(0x0b05); node->setProductId(0x4500); node->setVersion(0x0040); node->addKeys(KEY_BACK, KEY_HOMEPAGE, BTN_A, BTN_B, BTN_X, BTN_Y, BTN_TL, BTN_TR, BTN_MODE, BTN_THUMBL, BTN_THUMBR); // No relative axes node->addAbsAxis(ABS_X, nullptr); node->addAbsAxis(ABS_Y, nullptr); node->addAbsAxis(ABS_Z, nullptr); node->addAbsAxis(ABS_RZ, nullptr); node->addAbsAxis(ABS_GAS, nullptr); node->addAbsAxis(ABS_BRAKE, nullptr); node->addAbsAxis(ABS_HAT0X, nullptr); node->addAbsAxis(ABS_HAT0Y, nullptr); node->addAbsAxis(ABS_MISC, nullptr); node->addAbsAxis(0x29, nullptr); node->addAbsAxis(0x2a, nullptr); // No switches node->addInputProperty(INPUT_PROP_DIRECT); // Note: this device has MSC and LED bitmaps as well. return node; }
key commit(xmr_amount amount, key mask) { mask = scalarmultBase(mask); key am = d2h(amount); key bH = scalarmultH(am); addKeys(mask, mask, bH); return mask; }
//sums a vector of curve points (for scalars use sc_add) void sumKeys(key & Csum, const keyV & Cis) { identity(Csum); size_t i = 0; for (i = 0; i < Cis.size(); i++) { addKeys(Csum, Csum, Cis[i]); } }
key commit(xmr_amount amount, const key &mask) { key c = scalarmultBase(mask); key am = d2h(amount); key bH = scalarmultH(am); addKeys(c, c, bH); return c; }
key zeroCommit(xmr_amount amount) { key mask = identity(); mask = scalarmultBase(mask); key am = d2h(amount); key bH = scalarmultH(am); addKeys(mask, mask, bH); return mask; }
//generates a <secret , public> / Pedersen commitment to the amount tuple<ctkey, ctkey> ctskpkGen(xmr_amount amount) { ctkey sk, pk; skpkGen(sk.dest, pk.dest); skpkGen(sk.mask, pk.mask); key am = d2h(amount); key bH = scalarmultH(am); addKeys(pk.mask, pk.mask, bH); return make_tuple(sk, pk); }
int AddKeysOperation::execute() const { if (m_data.isEmpty()) return 0; QVariantMap map = load(m_file); map = addKeys(map, m_data); if (map.isEmpty()) return 1; // Write data again: return save(map, m_file) ? 0 : 2; }
MockInputDeviceNode* getMidPowerBtn() { auto node = new MockInputDeviceNode(); node->setPath("/dev/input/event1"); node->setName("mid_powerbtn"); node->setLocation("power-button/input0"); // UniqueId not set node->setBusType(0x0019); node->setVendorId(0); node->setProductId(0); node->setVersion(0); node->addKeys(KEY_POWER); // No relative axes // No absolute axes // No switches node->addInputProperty(INPUT_PROP_DIRECT); return node; }
MockInputDeviceNode* getGpioKeys() { auto node = new MockInputDeviceNode(); node->setPath("/dev/input/event0"); node->setName("gpio-keys"); node->setLocation("gpio-keys/input0"); // UniqueId not set node->setBusType(0x0019); node->setVendorId(0x0001); node->setProductId(0x0001); node->setVersion(0x0100); node->addKeys(KEY_CONNECT); // No relative axes // No absolute axes // No switches node->addInputProperty(INPUT_PROP_DIRECT); return node; }
MockInputDeviceNode* getH2wButton() { auto node = new MockInputDeviceNode(); node->setPath("/dev/input/event4"); node->setName("h2w button"); // Location not set // UniqueId not set node->setBusType(0); node->setVendorId(0); node->setProductId(0); node->setVersion(0); node->addKeys(KEY_MEDIA); // No relative axes // No absolute axes // No switches node->addInputProperty(INPUT_PROP_DIRECT); return node; }
MockInputDeviceNode* getNexusRemote() { auto node = new MockInputDeviceNode(); node->setPath("/dev/input/event2"); node->setName("Nexus Remote"); // Location not set node->setUniqueId("78:86:D9:50:A0:54"); node->setBusType(0x0005); node->setVendorId(0x18d1); node->setProductId(0x2c42); node->setVersion(0); node->addKeys(KEY_UP, KEY_LEFT, KEY_RIGHT, KEY_DOWN, KEY_BACK, KEY_PLAYPAUSE, KEY_HOMEPAGE, KEY_SEARCH, KEY_SELECT); // No relative axes node->addAbsAxis(ABS_MISC, nullptr); // No switches node->addInputProperty(INPUT_PROP_DIRECT); return node; }
MockInputDeviceNode* getButtonJack() { auto node = new MockInputDeviceNode(); node->setPath("/dev/input/event2"); node->setName("apq8064-tabla-snd-card Button Jack"); node->setLocation("ALSA"); // UniqueId not set node->setBusType(0); node->setVendorId(0); node->setProductId(0); node->setVersion(0); node->addKeys(BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7); // No relative axes // No absolute axes // No switches // No forcefeedback node->addInputProperty(INPUT_PROP_DIRECT); return node; }
void KeyAddDialog::on_add_clicked() { if( !skView->selectionModel()->hasSelection() ) return; QList<CKey> keys; Q_FOREACH( const QModelIndex &index, skView->selectionModel()->selectedRows() ) { const CKey k = keyModel->key( index ); keys << k; if( usedView->findItems( k.recipient, Qt::MatchExactly ).isEmpty() ) { QTreeWidgetItem *i = new QTreeWidgetItem( usedView ); i->setText( 0, k.recipient ); i->setText( 1, k.cert.issuerInfo( "CN" ) ); i->setText( 2, k.cert.expiryDate().toLocalTime().toString( "dd.MM.yyyy" ) ); i->setData( 0, Qt::UserRole, SslCertificate( k.cert ).isTempel() ); usedView->addTopLevelItem( i ); } } addKeys( keys ); saveHistory(); }
key zeroCommit(xmr_amount amount) { key am = d2h(amount); key bH = scalarmultH(am); return addKeys(G, bH); }
void KeyCache::refreshKeys(const QString &dir) { mNewKeys.remove(dir); mCurKeys.remove(dir); addKeys(dir); }
uint32_t CBFgpInfo_calcHash( const CBFgpInfo fgp_info, bool with_UA, bool with_PluginStrings, bool with_ScreenResolution, const char* RE_key ) { uint32_t hash_i32 = 0; ZnkStr keys = ZnkStr_new( "" ); size_t count = 0; if( with_UA ){ count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_userAgent_), count ); } count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_language_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_colorDepth_), count ); if( with_ScreenResolution ){ count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_ScreenResolution_), count ); } count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_TimezoneOffset_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_SessionStorage_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_LocalStorage_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_IndexedDB_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_BodyAddBehavior_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_OpenDatabase_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_CpuClass_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_Platform_), count ); count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_doNotTrack_), count ); if( with_PluginStrings ){ count = addKeys( keys, ZnkStr_cstr(fgp_info->Fgp_PluginsString_), count ); } { ZnkStr fgp_str = ZnkStr_new( "" ); CBFinger_Fgp_Canvas( fgp_str, RE_key ); if( !ZnkStr_empty( fgp_str ) ){ count = addKeys( keys, ZnkStr_cstr(fgp_str), count ); } ZnkStr_delete( fgp_str ); } hash_i32 = RanoHash_murmurhash3_32_gc( ZnkStr_cstr(keys), ZnkStr_leng(keys), 31 ); ZnkStr_delete( keys ); return hash_i32; }
//addKeys1 //aGB = aG + B where a is a scalar, G is the basepoint, and B is a point void addKeys1(key &aGB, const key &a, const key & B) { key aG = scalarmultBase(a); addKeys(aGB, aG, B); }
void KeyAddDialog::addCardCert() { addKeys( QList<CKey>() << CKey( qApp->tokenData().cert() ) ); }
bool AddKeysOperation::test() const { QVariantMap testMap; QVariantMap subKeys; subKeys.insert(QLatin1String("subsubkeys"), QVariantMap()); subKeys.insert(QLatin1String("testbool"), true); testMap.insert(QLatin1String("subkeys"), subKeys); subKeys.clear(); testMap.insert(QLatin1String("subkeys2"), subKeys); testMap.insert(QLatin1String("testint"), 23); KeyValuePairList data; data.append(KeyValuePair(QLatin1String("bool-true"), QString::fromLatin1("bool:trUe"))); data.append(KeyValuePair(QLatin1String("bool-false"), QString::fromLatin1("bool:false"))); data.append(KeyValuePair(QLatin1String("int"), QString::fromLatin1("int:42"))); data.append(KeyValuePair(QLatin1String("qstring"), QString::fromLatin1("QString:test string."))); data.append(KeyValuePair(QLatin1String("qbytearray"), QString::fromLatin1("QByteArray:test array."))); data.append(KeyValuePair(QLatin1String("subkeys/qbytearray"), QString::fromLatin1("QByteArray:test array."))); data.append(KeyValuePair(QLatin1String("subkeys/newsubkeys/qbytearray"), QString::fromLatin1("QByteArray:test array."))); data.append(KeyValuePair(QLatin1String("newsub/1/2/3/qbytearray"), QString::fromLatin1("QByteArray:test array."))); data.append(KeyValuePair(QLatin1String("newsub/1/2.1/3/qbytearray"), QString::fromLatin1("QByteArray:test array."))); QVariantMap result = addKeys(testMap, data); if (result.count() != 9) return false; // subkeys: QVariantMap cur = result.value(QLatin1String("subkeys")).toMap(); if (cur.count() != 4 || !cur.contains(QLatin1String("qbytearray")) || !cur.contains(QLatin1String("testbool")) || !cur.contains(QLatin1String("subsubkeys")) || !cur.contains(QLatin1String("newsubkeys"))) return false; // subkeys/newsubkeys: QVariantMap tmp = cur; cur = cur.value(QLatin1String("newsubkeys")).toMap(); if (cur.count() != 1 || !cur.contains(QLatin1String("qbytearray"))) return false; // subkeys/subsubkeys: cur = tmp.value(QLatin1String("subsubkeys")).toMap(); if (cur.count() != 0) return false; // newsub: cur = result.value(QLatin1String("newsub")).toMap(); if (cur.count() != 1 || !cur.contains(QLatin1String("1"))) return false; // newsub/1: cur = cur.value(QLatin1String("1")).toMap(); if (cur.count() != 2 || !cur.contains(QLatin1String("2")) || !cur.contains(QLatin1String("2.1"))) return false; // newsub/1/2: tmp = cur; cur = cur.value(QLatin1String("2")).toMap(); if (cur.count() != 1 || !cur.contains(QLatin1String("3"))) return false; // newsub/1/2/3: cur = cur.value(QLatin1String("3")).toMap(); if (cur.count() != 1 || !cur.contains(QLatin1String("qbytearray"))) return false; // newsub/1/2.1: cur = tmp.value(QLatin1String("2.1")).toMap(); if (cur.count() != 1 || !cur.contains(QLatin1String("3"))) return false; // newsub/1/2.1/3: cur = cur.value(QLatin1String("3")).toMap(); if (cur.count() != 1 || !cur.contains(QLatin1String("qbytearray"))) return false; // subkeys2: cur = result.value(QLatin1String("subkeys2")).toMap(); if (cur.count() != 0) return false; // values: if (!result.contains(QLatin1String("bool-true")) || !result.value(QLatin1String("bool-true")).toBool()) return false; if (!result.contains(QLatin1String("bool-false")) || result.value(QLatin1String("bool-false")).toBool()) return false; if (!result.contains(QLatin1String("int")) || result.value(QLatin1String("int")).toInt() != 42) return false; if (!result.contains(QLatin1String("qstring")) || result.value(QLatin1String("qstring")).toString() != QLatin1String("test string.")) return false; if (!result.contains(QLatin1String("qbytearray")) || result.value(QLatin1String("qbytearray")).toByteArray() != "test array.") return false; // Make sure we do not overwrite data: // preexisting: data.clear(); data.append(KeyValuePair(QLatin1String("testint"), QString::fromLatin1("int:4"))); result = addKeys(testMap, data); if (!result.isEmpty()) return false; data.clear(); data.append(KeyValuePair(QLatin1String("subkeys/testbool"), QString::fromLatin1("int:24"))); result = addKeys(testMap, data); if (!result.isEmpty()) return false; // data inserted before: data.clear(); data.append(KeyValuePair(QLatin1String("bool-true"), QString::fromLatin1("bool:trUe"))); data.append(KeyValuePair(QLatin1String("bool-true"), QString::fromLatin1("bool:trUe"))); result = addKeys(testMap, data); if (!result.isEmpty()) return false; return true; }
bool ossimPredatorKlvTable::addKeys(const std::vector<ossim_uint8>& buffer) { return addKeys(&buffer.front(), buffer.size()); }
rct::key addKeys(const key &A, const key &B) { key k; addKeys(k, A, B); return k; }
BOOL LLPreviewGesture::postBuild() { LLLineEditor* edit; LLComboBox* combo; LLButton* btn; LLScrollListCtrl* list; LLTextBox* text; LLCheckBoxCtrl* check; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "trigger_editor"); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mTriggerEditor = edit; text = LLViewerUICtrlFactory::getTextBoxByName(this, "replace_text"); text->setEnabled(FALSE); mReplaceText = text; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "replace_editor"); edit->setEnabled(FALSE); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mReplaceEditor = edit; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "modifier_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mModifierCombo = combo; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "key_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mKeyCombo = combo; list = LLViewerUICtrlFactory::getScrollListByName(this, "library_list"); list->setCommitCallback(onCommitLibrary); list->setDoubleClickCallback(onClickAdd); list->setCallbackUserData(this); mLibraryList = list; btn = LLViewerUICtrlFactory::getButtonByName(this, "add_btn"); btn->setClickedCallback(onClickAdd); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mAddBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "up_btn"); btn->setClickedCallback(onClickUp); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mUpBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "down_btn"); btn->setClickedCallback(onClickDown); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDownBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "delete_btn"); btn->setClickedCallback(onClickDelete); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDeleteBtn = btn; list = LLViewerUICtrlFactory::getScrollListByName(this, "step_list"); list->setCommitCallback(onCommitStep); list->setCallbackUserData(this); mStepList = list; // Options text = LLViewerUICtrlFactory::getTextBoxByName(this, "options_text"); text->setBorderVisible(TRUE); mOptionsText = text; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "animation_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitAnimation); combo->setCallbackUserData(this); mAnimationCombo = combo; LLRadioGroup* group; group = LLViewerUICtrlFactory::getRadioGroupByName(this, "animation_trigger_type"); group->setVisible(FALSE); group->setCommitCallback(onCommitAnimationTrigger); group->setCallbackUserData(this); mAnimationRadio = group; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "sound_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitSound); combo->setCallbackUserData(this); mSoundCombo = combo; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "chat_editor"); edit->setVisible(FALSE); edit->setCommitCallback(onCommitChat); //edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mChatEditor = edit; check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_anim_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitAnimCheck = check; check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_time_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitTimeCheck = check; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "wait_time_editor"); edit->setEnabled(FALSE); edit->setVisible(FALSE); edit->setPrevalidate(LLLineEditor::prevalidateFloat); // edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitOnFocusLost(TRUE); edit->setCommitCallback(onCommitWaitTime); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mWaitTimeEditor = edit; // Buttons at the bottom check = LLViewerUICtrlFactory::getCheckBoxByName(this, "active_check"); check->setCommitCallback(onCommitActive); check->setCallbackUserData(this); mActiveCheck = check; btn = LLViewerUICtrlFactory::getButtonByName(this, "save_btn"); btn->setClickedCallback(onClickSave); btn->setCallbackUserData(this); mSaveBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "preview_btn"); btn->setClickedCallback(onClickPreview); btn->setCallbackUserData(this); mPreviewBtn = btn; // Populate the comboboxes addModifiers(); addKeys(); addAnimations(); addSounds(); const LLInventoryItem* item = getItem(); if (item) { childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); } return TRUE; }
bool ossimPredatorKlvTable::addKeys(const ossim_uint8* buffer, ossim_uint32 length) { std::vector<ossim_uint8> bufferToParse; bufferToParse = theNeedToParseBuffer; if(buffer) { bufferToParse.insert(bufferToParse.end(), buffer, buffer + length); } theNeedToParseBuffer.clear(); ossim_uint32 currentIdx = 0; ossim_uint32 totalLen = bufferToParse.size(); const ossim_uint8* bufPtr = &bufferToParse.front(); if(totalLen < 1) return false; while(std::equal(theKlvKey, theKlvKey + 4, &bufPtr[currentIdx])) // while we are looking at klv keys keep parsing { if((currentIdx+16) >= totalLen) { theNeedToParseBuffer.clear(); theNeedToParseBuffer.insert(theNeedToParseBuffer.end(), &bufPtr[currentIdx], &bufPtr[totalLen]); return true; } ossimPredatorKlvTable::Node node; ossim_uint32 saveIdx = currentIdx; node.theId = findPredatorKlvIndex(&bufPtr[currentIdx]); if(node.theId < 0) { if(traceDebug()) { ossim_uint32 tempId = currentIdx + 16; std::cout << "**************UNDEFINED KEY**************\n"; std::cout << "WITH SIZE === " << klv_decode_length(bufPtr, tempId) << std::endl; PRINT_KEY(&bufPtr[currentIdx]); } //ossim_uint32 tempId = currentIdx + 16; //std::cout << "**************UNDEFINED KEY**************\n"; //std::cout << "WITH SIZE === " << klv_decode_length(bufPtr, tempId) << std::endl; // PRINT_KEY(&bufPtr[currentIdx]); // //ossim_float32 f = *reinterpret_cast<const ossim_float32*>(&bufPtr[tempId]); //theEndian.swap(f); // std::cout << "POSSIBLE VALUE === " << f << std::endl; } //PRINT_KEY(&bufPtr[currentIdx]); currentIdx += 16; int klvLength = klv_decode_length(bufPtr, currentIdx); if(klvLength > 0) { if((currentIdx + klvLength) <= totalLen) { node.theValue.insert(node.theValue.end(), &bufPtr[currentIdx], &bufPtr[currentIdx + klvLength]); currentIdx += klvLength; if(node.theId >=0) { if((node.theId == KLV_BASIC_UNIVERSAL_METADATA_SET)|| (node.theId == KLV_KEY_SECURITY_CLASSIFICATION_SET)) { theNeedToParseBuffer.insert(theNeedToParseBuffer.end(), node.theValue.begin(), node.theValue.end()); theNeedToParseBuffer.insert(theNeedToParseBuffer.end(), &bufPtr[currentIdx], &bufPtr[totalLen]); return addKeys(0,0); } else if(node.theId == KLV_UAS_DATALINK_LOCAL_DATASET) { addUasDatalinkLocalDataSet(node.theValue); return addKeys(0,0); } else { theKlvParameters.insert(std::make_pair(static_cast<ossimPredatorKlvIndex>(node.theId), node)); // std::cout << "VALUE = " << getValueAsString((PredatorKlvIndex)node.theId) << std::endl; // std::cout << "SIZE = " << klvLength << std::endl; } } } else { theNeedToParseBuffer.insert(theNeedToParseBuffer.end(), &bufPtr[saveIdx], &bufPtr[totalLen]); return true; } } if(currentIdx >= totalLen) return false; } return false; }