libcurl を使用して Windows azure から blob をダウンロードしています。これは公開されており、http サイトで正常にダウンロードできます。ただし、自己署名証明書と秘密キーを使用して Azure BLOB ストレージを非公開にする場合、ファイルのダウンロードは失敗し、「指定されたリソースは存在しません」というメッセージが表示されます。
コードは以下の通り
CURL *curl;
FILE *fp;
CURLcode res;
bool success = true;
string CloudContainerPath = "https://MyTest.blob.core.windows.net/Mytest/";
string path = CloudContainerPath+fileNameJsonVal.asCString();
char *url = &path[0];
char *outfilename = (char *)fileNameJsonVal.asCString();
char errbuf[CURL_ERROR_SIZE];
int length = 0;
errbuf[0] = '\0';
static const char *pCACertFile = "D:\\LibCURL\\cacert.pem";
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
* set the file with the certs vaildating the server */
curl_easy_setopt(curl, CURLOPT_CAPATH,pCACertFile);
curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(
fp);