#include <cafe.h>
#include <cafe/nssl/nsslclient.h>

NSSL_RVAL NSSLExportInternalServerCertificate(NSSLServerCertID id,
                                              char* pCertBuf,
                                              int *pCertBufSize,
                                              NSSLCertType *pCertType);


id ID of the certificate to be exported.
pCertBuf Pointer to buffer where the certificate data is to be exported. Must be aligned to NSSL_IO_BUFFER_ALIGN.
pCertBufSize Pointer to hold size of pCertBuf. The caller should provide allocated size of pCertBuf, on return it will contain the size of pCertBuf filled with the certificate data. The value inside of pCertBufSize must be a multiple of NSSL_IO_BUFFER_ALIGN
pCertType Pointer to hold the type of certificate (currently only NSSL_CERT_TYPE_DER is supported).

Return Values

NSSL_RVAL_OK on success, error code of type NSSL_RVAL on failure.


Exports the specified internal server certificate (if the certificate is 'exportable').

Access to the individual built-in certificate is restricted based on capabilities of the application. NSSL_RVAL_CERT_NO_ACCESS is returned if application tries to use a certificate for which it does not have access permission. NSSL_RVAL_CERT_NOT_EXPORTALE is returned if the certificate is not 'exportable'.

Pass pCertBuf = NULL and *pCertBufSize=0 to get the actual size of the certificate data in pCertBufSize. Note that the returned size will not necessarily be a multiple of NSSL_IO_BUFFER_ALIGN and should be rounded up to a multiple of NSSL_IO_BUFFER_ALIGN if being used to allocate pCertBuf or being passed back into the function through pCertBufSize.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

See Also


Revision History

2015/07/08 Updated general description and description of 'pCertBufSize'.
2012/08/08 Initial version.