The updated TclSMimeMessage component provides the ExtractSecurityInfo method that extracts the security algorithms, and also the included certificates. The extracted information is stored within the following properties:
EncryptionAlgorithm, HashAlgorithm, and Certificates.
The ExtractSecurityInfo method allows you to get the mentioned information before decrypting and verifying the message. However, if the message is first encrypted and then signed, you can obtain only the hash algorithm information. If the message is signed and encrypted, you will get only the encryption algorithm information. So, if you need to get both the hash and encryption algorithms, you will have to decrypt and verify the message using the DecryptAndVerify method. This method extracts the mentioned above information, as well.
//retrieving an S/MIME-protected Email message
//extracting the cipher information
clSMimeMessage.Certificates.Items.Count; //extracted certificates
clSMimeMessage.EncryptionAlgorithm; //the enryption algorithm identifier, see the comments above
clSMimeMessage.HashAlgorithm; //the hash algorithm identifier
clSMimeMessage.EncryptionAlgorithmName; //the friendly cipher name
clSMimeMessage.HashAlgorithmName; //the friendly hash algorithm name
certificate := clSMimeMessage.Certificates.CertificateByEmail('email@example.com');
//decrypting the message and verifying digital signatures