这篇教程C++ DecodeBase64函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DecodeBase64函数的典型用法代码示例。如果您正苦于以下问题:C++ DecodeBase64函数的具体用法?C++ DecodeBase64怎么用?C++ DecodeBase64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DecodeBase64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: HTTPServerHandleAuthHeadervoid HTTPServerHandleAuthHeader(HTTPSession *Heads,int HeaderType, char *Type, char *Data){char *Tempstr=NULL, *Name=NULL, *Value=NULL, *ptr;char *nonce=NULL, *cnonce=NULL, *request_count=NULL, *qop=NULL, *algo=NULL, *uri=NULL;int len;if (strcmp(Type,"Basic")==0){ Tempstr=DecodeBase64(Tempstr, &len, Data); ptr=GetToken(Tempstr,":",&Heads->UserName,0); Heads->Password=CopyStr(Heads->Password,ptr);}else if (strcmp(Type,"Digest")==0){ uri=CopyStr(uri,""); algo=CopyStr(algo,""); ptr=GetNameValuePair(Data,",","=",&Name,&Value); while (ptr) { if (StrLen(Name) && StrLen(Value)) { StripLeadingWhitespace(Name); StripLeadingWhitespace(Value); if (strcmp(Name,"username")==0) Heads->UserName=CopyStr(Heads->UserName,Value); if (strcmp(Name,"response")==0) Heads->Password=CopyStr(Heads->Password,Value); if (strcmp(Name,"nonce")==0) nonce=CopyStr(nonce,Value); if (strcmp(Name,"cnonce")==0) cnonce=CopyStr(cnonce,Value); if (strcmp(Name,"nc")==0) request_count=CopyStr(request_count,Value); if (strcmp(Name,"qop")==0) qop=CopyStr(qop,Value); if (strcmp(Name,"uri")==0) uri=CopyStr(uri,Value); if (strcmp(Name,"algorithm")==0) algo=CopyStr(algo,Value); } ptr=GetNameValuePair(ptr,",","=",&Name,&Value); }// server nonce (nonce), request counter (nc), client nonce (cnonce), quality of protection code (qop) and HA2 result is calculated. The result is the "response" value provided by the client.if (StrLen(qop)) Heads->AuthDetails=MCopyStr(Heads->AuthDetails,uri,":",algo,":",nonce,":",request_count,":",cnonce,":",qop, NULL);else Heads->AuthDetails=CopyStr(Heads->AuthDetails,nonce);}DestroyString(qop);DestroyString(uri);DestroyString(algo);DestroyString(Name);DestroyString(Value);DestroyString(nonce);DestroyString(cnonce);DestroyString(Tempstr);DestroyString(request_count);}
开发者ID:ColumPaget,项目名称:Alaya,代码行数:53,
示例2: DecodeStringToBinarystatic voidDecodeStringToBinary( byte *p, size_t size, char *str){#ifdef BINARY_IS_BASE64 DecodeBase64(p,size,str,strlen(str));#else int i; for ( i = 0 ; i < size ; i ++ , p ++ ) { if ( *str == '//' ) { str ++; switch (*str) { case 'b': *p = '/b'; str ++; break; case 'f': *p = '/f'; str ++; break; case 'n': *p = '/n'; str ++; break; case 'r': *p = '/r'; str ++; break; case 't': *p = '/t'; str ++; break; case 'u': str ++; *p = (unsigned char)HexToInt(str,2); str += 2; break; default: *p = *str; str ++; break; } } else { *p = *str; str ++; } }#endif}
开发者ID:ogochan,项目名称:libmondai,代码行数:52,
示例3: GetBeaconPublicKeystd::string GetBeaconPublicKey(const std::string& cpid, bool bAdvertisingBeacon){ //3-26-2017 - Ensure beacon public key is within 6 months of network age (If advertising, let it be returned as missing after 5 months, to ensure the public key is renewed seamlessly). int iMonths = bAdvertisingBeacon ? 5 : 6; int64_t iMaxSeconds = 60 * 24 * 30 * iMonths * 60; std::string sBeacon = RetrieveBeaconValueWithMaxAge(cpid, iMaxSeconds); if (sBeacon.empty()) return ""; // Beacon data structure: CPID,hashRand,Address,beacon public key: base64 encoded std::string sContract = DecodeBase64(sBeacon); std::vector<std::string> vContract = split(sContract.c_str(),";"); if (vContract.size() < 4) return ""; std::string sBeaconPublicKey = vContract[3]; return sBeaconPublicKey;}
开发者ID:TheCharlatan,项目名称:Gridcoin-Research,代码行数:14,
示例4: DecodeBase64/*static*/std::string I2PSession::GenerateB32AddressFromDestination(const std::string& destination){ std::string canonicalDest = destination; for (size_t pos = canonicalDest.find_first_of('-'); pos != std::string::npos; pos = canonicalDest.find_first_of('-', pos)) canonicalDest[pos] = '+'; for (size_t pos = canonicalDest.find_first_of('~'); pos != std::string::npos; pos = canonicalDest.find_first_of('~', pos)) canonicalDest[pos] = '/'; std::string rawHash = DecodeBase64(canonicalDest); uint256 hash; SHA256((const unsigned char*)rawHash.c_str(), rawHash.size(), (unsigned char*)&hash); std::string result = EncodeBase32(hash.begin(), hash.end() - hash.begin()) + ".b32.i2p"; for (size_t pos = result.find_first_of('='); pos != std::string::npos; pos = result.find_first_of('=', pos-1)) result.erase(pos, 1); return result;}
开发者ID:418TeapotCoin,项目名称:anoncoin,代码行数:16,
示例5: DecodeBase64int WXBizMsgCrypt::GenAesKeyFromEncodingKey( const std::string & sEncodingKey, std::string & sAesKey){ if(kEncodingKeySize != sEncodingKey.size()) { return -1; } std::string sBase64 = sEncodingKey + "="; int ret = DecodeBase64(sBase64, sAesKey); if(0 != ret || kAesKeySize != sAesKey.size()) { return -1; } return 0;}
开发者ID:lgyhitler,项目名称:node-weixin-crypto,代码行数:16,
示例6: DecodePSBTbool DecodePSBT(PartiallySignedTransaction& psbt, const std::string& base64_tx, std::string& error){ std::vector<unsigned char> tx_data = DecodeBase64(base64_tx.c_str()); CDataStream ss_data(tx_data, SER_NETWORK, PROTOCOL_VERSION); try { ss_data >> psbt; if (!ss_data.empty()) { error = "extra data after PSBT"; return false; } } catch (const std::exception& e) { error = e.what(); return false; } return true;}
开发者ID:fujicoin,项目名称:fujicoin,代码行数:16,
示例7: DetectBase64DecodeDoMatchint DetectBase64DecodeDoMatch(DetectEngineThreadCtx *det_ctx, Signature *s, const SigMatch *sm, uint8_t *payload, uint32_t payload_len){ DetectBase64Decode *data = (DetectBase64Decode *)sm->ctx; int decode_len;#if 0 printf("Input data:/n"); PrintRawDataFp(stdout, payload, payload_len);#endif if (data->relative) { payload += det_ctx->buffer_offset; payload_len -= det_ctx->buffer_offset; } if (data->offset) { if (data->offset >= payload_len) { return 0; } payload = payload + data->offset; payload_len -= data->offset; } decode_len = MIN(payload_len, data->bytes);#if 0 printf("Decoding:/n"); PrintRawDataFp(stdout, payload, decode_len);#endif det_ctx->base64_decoded_len = DecodeBase64(det_ctx->base64_decoded, payload, decode_len, 0); SCLogDebug("Decoded %d bytes from base64 data.", det_ctx->base64_decoded_len);#if 0 if (det_ctx->base64_decoded_len) { printf("Decoded data:/n"); PrintRawDataFp(stdout, det_ctx->base64_decoded, det_ctx->base64_decoded_len); }#endif return det_ctx->base64_decoded_len > 0;}
开发者ID:tutengfei,项目名称:suricata,代码行数:45,
示例8: SelectParamsvoid PaymentServerTests::paymentServerTests(){ SelectParams(CBaseChainParams::MAIN); OptionsModel optionsModel; PaymentServer* server = new PaymentServer(NULL, false); X509_STORE* caStore = X509_STORE_new(); X509_STORE_add_cert(caStore, parse_b64der_cert(caCert_BASE64)); PaymentServer::LoadRootCAs(caStore); server->setOptionsModel(&optionsModel); server->uiReady(); // Now feed PaymentRequests to server, and observe signals it produces: std::vector<unsigned char> data = DecodeBase64(paymentrequest1_BASE64); SendCoinsRecipient r = handleRequest(server, data); QString merchant; r.paymentRequest.getMerchant(caStore, merchant); QCOMPARE(merchant, QString("testmerchant.org")); // Version of the above, with an expired certificate: data = DecodeBase64(paymentrequest2_BASE64); r = handleRequest(server, data); r.paymentRequest.getMerchant(caStore, merchant); QCOMPARE(merchant, QString("")); // Long certificate chain: data = DecodeBase64(paymentrequest3_BASE64); r = handleRequest(server, data); r.paymentRequest.getMerchant(caStore, merchant); QCOMPARE(merchant, QString("testmerchant8.org")); // Long certificate chain, with an expired certificate in the middle: data = DecodeBase64(paymentrequest4_BASE64); r = handleRequest(server, data); r.paymentRequest.getMerchant(caStore, merchant); QCOMPARE(merchant, QString("")); // Validly signed, but by a CA not in our root CA list: data = DecodeBase64(paymentrequest5_BASE64); r = handleRequest(server, data); r.paymentRequest.getMerchant(caStore, merchant); QCOMPARE(merchant, QString("")); // Try again with no root CA's, verifiedMerchant should be empty: caStore = X509_STORE_new(); PaymentServer::LoadRootCAs(caStore); data = DecodeBase64(paymentrequest1_BASE64); r = handleRequest(server, data); r.paymentRequest.getMerchant(caStore, merchant); QCOMPARE(merchant, QString("")); delete server;}
开发者ID:13XeNuS37,项目名称:bitcoin,代码行数:52,
|