Extract the body from an S/MIME entity.
Public Declare Function SMIME_Extract Lib "diCrPKI.dll" (ByVal strFileOut As String, ByVal strFileIn As String, ByVal nOptions As Long) As Long
nRet = SMIME_Extract(strFileOut, strFileOut, nOptions)
long __stdcall SMIME_Extract(const char *szFileOut, const char *szFileIn, long nOptions);
A positive number giving the size of the output file in bytes; or a negative error code.
static int dipki::Smime::Extract (const std::string &outputFile, const std::string &inputFile, Encoding encoding=Encoding::Default)
static Smime.extract(outputfile, inputfile, opts=0)
This is designed to extract the body from an S/MIME entity with a content type of application/pkcs7-mime
with base64 or binary transfer encoding.
In practice, it will extract the body from almost any type of S/MIME (or MIME) file,
except one with quoted-printable transfer encoding.
nRet = SMIME_Extract("cmsalice2bob-extracted.p7m", "cmsalice2bob-smime-env.txt", 0)
In this example, the input S/MIME file cmsalice2bob-smime-env.txt
was created from a
CMS enveloped-data file using SMIME_Wrap
.
The output should be a binary file identical to the original binary CMS file.