methodTstCustomMPCMSBroker.Encode
function Encode(aActions: TContentTypeArray; aStream, aDest: TStream; aDataType: tPKCS7DataType = pData): Boolean; overload;
Builds a nested CMS message: applies each protection in aActions in turn (element 0 wraps the raw content first, so it is the innermost layer; later elements wrap around it and end up outermost) to aStream, writing the result to aDest. aDataType tags the innermost content type. This is the mirror of Decode, whose aActions array is also innermost-first. Use this to produce a sign-then-encrypt (or any layered) message in one call.