Understanding of SignedCms.CheckSignature(True)

An understanding of SignedCms.CheckSignature(True) based on the code stated below.

' Create a ContentInfo object from the inner content obtained

' independently from encodedMessage.

Dim contentInfo As New ContentInfo(innerContent)


' Create a new, detached SignedCms message.

Dim signedCms As New SignedCms(contentInfo, True)


' encodedMessage is the encoded message received from

' the sender.



' Verify the signature without validating the

' certificate.



  • We have the innerContent (unsigned), which is message.
  • We have the detached signature, which is the encrypted hash of message.



Now the code.

  • Dim signedCms As New SignedCms(contentInfo, True) // This detaches the signature and the message, and signature here is the encrypted hash of message.
  • signedCms.Decode(message) // This decodes the encrypted hash of message to give the hash of the message.
  • signedCms.CheckSignature(True) // This does the Compare as shown above by computing the hash of Message and then verifying the hash we got above.





Comments (0)

Skip to main content