Added httpc AddTrustedRootCA.
This commit is contained in:
parent
049d2e2373
commit
d769879933
@ -121,6 +121,14 @@ Result httpcGetResponseStatusCode(httpcContext *context, u32* out, u64 delay);
|
|||||||
*/
|
*/
|
||||||
Result httpcGetResponseHeader(httpcContext *context, char* name, char* value, u32 valuebuf_maxsize);
|
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.
|
* @brief Downloads data from the HTTP context into a buffer.
|
||||||
* The *entire* content must be downloaded before using httpcCloseContext(), otherwise httpcCloseContext() will hang.
|
* The *entire* content must be downloaded before using httpcCloseContext(), otherwise httpcCloseContext() will hang.
|
||||||
@ -252,3 +260,12 @@ Result HTTPC_GetResponseHeader(Handle handle, Handle contextHandle, char* name,
|
|||||||
*/
|
*/
|
||||||
Result HTTPC_GetResponseStatusCode(Handle handle, Handle contextHandle, u32* out);
|
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);
|
||||||
|
|
||||||
|
@ -164,6 +164,11 @@ Result httpcGetResponseStatusCode(httpcContext *context, u32* out, u64 delay)
|
|||||||
return HTTPC_GetResponseStatusCode(context->servhandle, context->httphandle, out);
|
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 httpcDownloadData(httpcContext *context, u8* buffer, u32 size, u32 *downloadedsize)
|
||||||
{
|
{
|
||||||
Result ret=0;
|
Result ret=0;
|
||||||
@ -439,3 +444,19 @@ Result HTTPC_GetResponseStatusCode(Handle handle, Handle contextHandle, u32* out
|
|||||||
return cmdbuf[1];
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user