I tried to sign the certificate using a secure token, but encountered an unknown error -1073741275. This error occurred when I tried to use the SHA256 algorithm. Below is my code:
cert = certCol(0)
Dim signer As New CmsSigner(cert)
signer.IncludeOption = X509IncludeOption.EndCertOnly
signer.SignedAttributes.Add(New Pkcs9SigningTime())
signer.DigestAlgorithm = New Oid("2.16.840.1.101.3.4.2.1")
signedCms.ComputeSignature(signer, False)
encoded = signedCms.Encode()
sSign = Convert.ToBase64String(encoded)