TEST(BinarySerializationCompatibility, account_public_address) { cryptonote::AccountPublicAddress addr; fillPublicKey(addr.m_spendPublicKey, 0x50); fillPublicKey(addr.m_viewPublicKey, 0xAA); checkCompatibility(addr); }
/* * Take values from the subject keyfile and write them to the * current certificate. * val is filename of the subject keyfile * values of interest are the subject public key and the ski. */ int use_subject_keyfile( void *cert, void *val) { struct Certificate *certp = (struct Certificate *)cert; struct CertificateToBeSigned *ctftbsp = &certp->toBeSigned; struct SubjectPublicKeyInfo *spkinfop = &ctftbsp->subjectPublicKeyInfo; struct Extensions *extsp = &ctftbsp->extensions; struct Extension *extp; struct casn *spkp = &spkinfop->subjectPublicKey; if (val == NULL) return -1; // if no subjectPublicKey in the cert then get if from keyfile if (vsize_casn(&spkinfop->subjectPublicKey) <= 0) { write_objid(&spkinfop->algorithm.algorithm, id_rsadsi_rsaEncryption); write_casn(&spkinfop->algorithm.parameters.rsadsi_rsaEncryption, (uchar *) "", 0); if (!fillPublicKey(spkp, val)) return -1; } // always update SKI to match subjectPublicKey if (!(extp = find_extension(extsp, id_subjectKeyIdentifier, false))) extp = make_extension(extsp, id_subjectKeyIdentifier); writeHashedPublicKey(&extp->extnValue.subjectKeyIdentifier, spkp, false); return (SUCCESS); }
TEST(BinarySerializationCompatibility, TransactionOutput_TransactionOutputToKey) { cryptonote::TransactionOutput s; s.amount = 0xfff000ffff778822; cryptonote::TransactionOutputToKey out; fillPublicKey(out.key); s.target = out; checkCompatibility(s); }
void fillTransaction(cryptonote::Transaction& tx) { tx.version = 1; tx.unlockTime = 0x7f1234560089ABCD; cryptonote::TransactionInputGenerate gen; gen.height = 0xABCD123456EF; tx.vin.push_back(gen); cryptonote::TransactionInputToKey key; key.amount = 500123; key.keyOffsets = {12,3323,0x7f0000000000, std::numeric_limits<uint64_t>::max(), 0}; fillKeyImage(key.keyImage); tx.vin.push_back(key); cryptonote::TransactionInputMultisignature multisig; multisig.amount = 490000000; multisig.outputIndex = 424242; multisig.signatures = 4; tx.vin.push_back(multisig); cryptonote::TransactionOutput txOutput; txOutput.amount = 0xfff000ffff778822; cryptonote::TransactionOutputToKey out; fillPublicKey(out.key); txOutput.target = out; tx.vout.push_back(txOutput); tx.extra = {1,2,3,127,0,128,255}; tx.signatures.resize(3); for (size_t i = 0; i < boost::get<cryptonote::TransactionInputToKey>(tx.vin[1]).keyOffsets.size(); ++i) { crypto::signature sig; fillSignature(sig, i); tx.signatures[1].push_back(sig); } for (size_t i = 0; i < boost::get<cryptonote::TransactionInputMultisignature>(tx.vin[2]).signatures; ++i) { crypto::signature sig; fillSignature(sig, i+120); tx.signatures[2].push_back(sig); } }
void fillTransactionOutputMultisignature(cryptonote::TransactionOutputMultisignature& s) { crypto::public_key key; fillPublicKey(key, 0); s.keys.push_back(key); char start = 120; fillPublicKey(key, start++); s.keys.push_back(key); fillPublicKey(key, start++); s.keys.push_back(key); fillPublicKey(key, start++); s.keys.push_back(key); fillPublicKey(key, start++); s.keys.push_back(key); fillPublicKey(key, start++); s.keys.push_back(key); s.requiredSignatures = 12; }