CryptoSys PKI Pro Manual

SMIME_Wrap

Wrap a CMS object in an S/MIME entity.

VBA/VB6 Syntax

Public Declare Function SMIME_Wrap Lib "diCrPKI.dll" (ByVal strFileOut As String, ByVal strFileIn As String, ByVal strFeatures As String, ByVal nOptions As Long) As Long

nRet = SMIME_Wrap(strFileOut, strFileIn, strFeatures, nOptions)

C/C++ Syntax

long __stdcall SMIME_Wrap(const char *szFileOut, const char *szFileIn, const char *szFeatures, long nOptions);

Parameters

szFileOut
[in] string specifying the filename of the output file to be created.
szFileIn
[in] string specifying the filename of the input file.
szFeatures
[in] string to specify special features. For future use. Leave empty "" or NULL for defaults.
nOptions
[in] Zero (0) for defaults.
PKI_SMIME_ENCODE_BINARY to encode the body in binary encoding (default is base64).
PKI_SMIME_ADDX to add an "x-" to the content subtype.

Returns (VBA/C)

A positive number giving the size of the output file in bytes; or a negative error code.

.NET Equivalent

Smime.Wrap Method

C++ (STL) Equivalent

static int dipki::Smime::Wrap (const std::string &outputFile, const std::string &inputFile, Encoding encoding=Encoding::Default, AdvOpts advopts=AdvOpts::Default)

Python Equivalent

static Smime.wrap(outputfile, inputfile, opts=0)

Remarks

This forms an S/MIME entity with a Content-Type of application/pkcs7-mime from a binary CMS object. It works in file-to-file mode only. The input file is expected to be a binary CMS object of type enveloped-data, signed-data or compressed-data; otherwise it is an error. The type of input file is detected automatically. The output is a text file with the correct S/MIME headers according to [SMIME-MSG]. By default the body is encoded in base64. Use the PKI_SMIME_ENCODE_BINARY option to encode the body in "binary" instead. Use the PKI_SMIME_ADDX option to change the Content-Type to application/x-pkcs7-mime for compatibility with legacy applications. S/MIME signed messages with the multipart/signed format are currently not supported.

Example

nRet = SMIME_Wrap("cmsalice2bob-smime-env.txt", "cmsalice2bob.p7m", "", 0)

In this example, the binary file cmsalice2bob.p7m was created using CMS_MakeEnvData. The output file should look like the following.

Content-Type: application/pkcs7-mime;
        smime-type=enveloped-data;
        id="smime.p7m"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
        fileid="smime.p7m"

MIAGCSqGSIb3DQEHA6CAMIACAQAxgcAwgb0CAQAwJjASMRAwDgYDVQQDEwdDYXJs
UlNBAhBGNGvHgABWvBHTbi7NXXHQMA0GCSqGSIb3DQEBAQUABIGAFx80IYQbAX8+
7PIXJzUInDUydJv9tgogwzQY8KHwneD1Wcihc/Thi3QtSIQu4bnoPlSbGdF76SuE
Cajdnq5PDU34SnMywq8fyBxDM0ayUfYfMozZOhnM4mr9F4lF3zqtAhnukQF8b+Hv
cTgt4XHHrk2P5vHhdtaA4spSM9kDtpwwgAYJKoZIhvcNAQcBMBQGCCqGSIb3DQMH
BAh7TZ7TVakVU6CABCCNGoP9xsyKSFr1lFrffFky8Ym+efPbS4jx1ODxWzHa3wAA
AAAAAAAAAAA=

See Also

SMIME_Extract

[Contents] [Index]

[PREV: SMIME_Query...]   [Contents]   [Index]   
   [NEXT: TDEA_B64Mode...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.