*/
Result httpcGetResponseHeader(httpcContext *context, char* name, char* value, u32 valuebuf_maxsize);
+/**
+ * @brief Adds a trusted RootCA cert to a HTTP context.
+ * @param context Context to use.
+ * @param cert Pointer to DER cert.
+ * @param certsize Size of the DER cert.
+ */
+Result httpcAddTrustedRootCA(httpcContext *context, u8 *cert, u32 certsize);
+
/**
* @brief Downloads data from the HTTP context into a buffer.
* The *entire* content must be downloaded before using httpcCloseContext(), otherwise httpcCloseContext() will hang.
*/
Result HTTPC_GetResponseStatusCode(Handle handle, Handle contextHandle, u32* out);
+/**
+ * @brief Adds a trusted RootCA cert to a HTTP context.
+ * @param handle HTTPC service handle to use.
+ * @param contextHandle HTTP context handle to use.
+ * @param cert Pointer to DER cert.
+ * @param certsize Size of the DER cert.
+ */
+Result HTTPC_AddTrustedRootCA(Handle handle, Handle contextHandle, u8 *cert, u32 certsize);
+
return HTTPC_GetResponseStatusCode(context->servhandle, context->httphandle, out);
}
+Result httpcAddTrustedRootCA(httpcContext *context, u8 *cert, u32 certsize)
+{
+ return HTTPC_AddTrustedRootCA(context->servhandle, context->httphandle, cert, certsize);
+}
+
Result httpcDownloadData(httpcContext *context, u8* buffer, u32 size, u32 *downloadedsize)
{
Result ret=0;
return cmdbuf[1];
}
+Result HTTPC_AddTrustedRootCA(Handle handle, Handle contextHandle, u8 *cert, u32 certsize)
+{
+ u32* cmdbuf=getThreadCommandBuffer();
+
+ cmdbuf[0]=IPC_MakeHeader(0x24,2,2); // 0x240082
+ cmdbuf[1]=contextHandle;
+ cmdbuf[2]=certsize;
+ cmdbuf[3]=IPC_Desc_Buffer(certsize, IPC_BUFFER_R);
+ cmdbuf[4]=(u32)cert;
+
+ Result ret=0;
+ if(R_FAILED(ret=svcSendSyncRequest(handle)))return ret;
+
+ return cmdbuf[1];
+}
+