System.Security.Cryptography.pkcs.SignedCms

Hello, I'm trying to sign a message using the folowing code:

Dim myContentAs ContentInfo =New ContentInfo(System.Text.Encoding.UTF8.GetBytes(txtMessage.Text))

Dim mySignedCmsAs SignedCms =New SignedCms(myContent)

Dim myCmsSignerAs CmsSigner =New CmsSigner(myCert)

mySignedCms.ComputeSignature(myCmsSigner)'HERE OCCURS AN ERROR: Occured an internal error of data encoding. (in portuguese: Ocorreu um erro interno de encadeamento de certificados.)

Dim encodedSignedCms()AsByte = mySignedCms.Encode()

Does anyone can help me?

Is there any other way to sign and envelope messages?

[2152 byte] By [Urbyne] at [2007-12-24]