function DecryptAndCheckSignature(const Data: TBytes): TBytes; overload;
procedure DecryptAndCheckSignature(InStream, OutStream: TStream; TmpDecryptedStream: TStream = nil); overload;
procedure DecryptAndCheckSignature(const InFileName, OutFileName: string; const TmpFileName: string = ''); overload;
Description
The DecryptAndCheckSignature method decrypts the contents of the enveloped CMS/PKCS #7 message and verifies it the digital signature by using the certificate with a private key specified in the Certificate property. The method finds the recipient information corresponding to the specified certificate and decrypts the content information. After this the method finds the signature corresponding to the specified certificate and verifies it.
The decrypted data can be returned as an array of byte values or can be written to the OutStream stream or to the OutFileName file.
Data is an array of byte values that represents the CMS/PKCS #7 message to be decrypted and verified.
InStream is a TStream object that represents the CMS/PKCS #7 message to be decrypted and verified.
InFileName is a name of the file that contains the CMS/PKCS #7 message to be decrypted and verified.
OutStream is a TStream object that will contain the decrypted content information.
OutFileName is a name of the file that will contain the decrypted content information.
TmpDecryptedStream is a TStream object that will contain temporary data. If the TmpDecryptedStream 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.
DecryptAndCheckSignature raises an exception if the verification of a digital signature fails.
DecryptAndCheckSignature resets all properties of the SignedData and the EnvelopedData objects that store the information about the processed CMS/PKCS #7 message.
See Also