function SignAndEncrypt(const Data: TBytes; Encoding: TScCMSEncoding = ceDER): TBytes; overload;
procedure SignAndEncrypt(InStream, OutStream: TStream; TmpSignedStream: TStream = nil; Encoding: TScCMSEncoding = ceDER); overload;
procedure SignAndEncrypt(const InFileName, OutFileName: string; const TmpFileName: string = ''; Encoding: TScCMSEncoding = ceDER); overload;
Description
The SignAndEncrypt method creates a signature of the input data and encrypts this data by using the certificate specified in the Certificate property, and encodes the result information into an enveloped CMS/PKCS #7 message.
This method can return an array of byte values that represents the encoded message or can write this result to the OutStream stream or to the OutFileName file.
Data is an array of byte values that represents the input data to be signed and encrypted.
InStream is a TStream object that contains the input data to be signed and encrypted.
InFileName is a name of the file that contains the input data to be signed and encrypted.
OutStream is a TStream object that will contain the enveloped CMS/PKCS #7 message.
OutFileName is a name of the file that will contain the enveloped CMS/PKCS #7 message.
TmpSignedStream is a TStream object that will contain temporary data. If the TmpSignedStream parameter is nil, the TMemoryStream object will be created instead.
TmpFileName is a name of the file that will contain temporary data. If the TmpFileName parameter is empty, the TMemoryStream object will be created for temporary data.
Encoding specifies the output encoded format.
The symmetric encryption algorithm can be specified by the EncryptionAlgorithm property.
The hash algorithm can be specified by the DigestAlgorithm property.
SignAndEncrypt resets all properties of the SignedData and the EnvelopedData objects that store the information about the processed CMS/PKCS #7 message.
See Also