MCPcopy Create free account
hub / github.com/SIPp/sipp / encodeMasterKeySalt

Method encodeMasterKeySalt

src/jlsrtp.cpp:2518–2581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2516}
2517
2518int JLSRTP::encodeMasterKeySalt(std::string &mks, ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/)
2519{
2520 int retVal = -1;
2521 std::vector<unsigned char> concat;
2522 mks.clear();
2523 ActiveCrypto active_crypto = INVALID_CRYPTO;
2524
2525 if (crypto_attrib == ACTIVE_CRYPTO)
2526 {
2527 active_crypto = _active_crypto;
2528 }
2529 else
2530 {
2531 active_crypto = crypto_attrib;
2532 }
2533
2534 switch (active_crypto)
2535 {
2536 case PRIMARY_CRYPTO:
2537 {
2538 concat.insert(concat.end(), _primary_crypto.master_key.begin(), _primary_crypto.master_key.end());
2539 concat.insert(concat.end(), _primary_crypto.master_salt.begin(), _primary_crypto.master_salt.end());
2540
2541 //std::cout << "encodeMasterKeySalt(): concat:[";
2542 //for (unsigned int i = 0; i < concat.size(); i++)
2543 //{
2544 // printf("%02X", concat[i]);
2545 //}
2546 //std::cout << "]" << std::endl;
2547
2548 mks = base64Encode(concat);
2549
2550 //std::cout << "encodeMasterKeySalt(): [" << mks << "]" << std::endl;
2551 retVal = 0;
2552 }
2553 break;
2554
2555 case SECONDARY_CRYPTO:
2556 {
2557 concat.insert(concat.end(), _secondary_crypto.master_key.begin(), _secondary_crypto.master_key.end());
2558 concat.insert(concat.end(), _secondary_crypto.master_salt.begin(), _secondary_crypto.master_salt.end());
2559
2560 //std::cout << "encodeMasterKeySalt(): concat:[";
2561 //for (unsigned int i = 0; i < concat.size(); i++)
2562 //{
2563 // printf("%02X", concat[i]);
2564 //}
2565 //std::cout << "]" << std::endl;
2566
2567 mks = base64Encode(concat);
2568
2569 //std::cout << "encodeMasterKeySalt(): [" << mks << "]" << std::endl;
2570 retVal = 0;
2571 }
2572 break;
2573
2574 default:
2575 {

Callers 1

createSendingMessageMethod · 0.80

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected