[VB6 equivalent: CMS_MakeDetachedSig]
Dim nRet As Integer
Dim strEPKFile As String
Dim strCertFile As String
Dim strOutFile As String
Dim strHexDigest As String
Dim strPrivateKey As String
strEPKFile = "AlicePrivRSASign.epk"
strCertFile = "AliceRSASignByCarl.cer"
strOutFile = "DetSignByAlice.bin"
strHexDigest = "406aec085279ba6e16022d9e0629c0229687dd48"
' First, Alice reads her private key into a string
strPrivateKey = Rsa.ReadEncPrivateKey(strEPKFile, "password").ToString()
If strPrivateKey.Length = 0 Then
Console.WriteLine("Cannot read private key")
Exit Sub
End If
' Alice makes a detached signature using
' the hash of the content and her private key
nRet = Cms.MakeDetachedSig(strOutFile, strHexDigest, _
strCertFile, strPrivateKey, 0)
Console.WriteLine("CMS_MakeDetachedSig returns " & nRet)
See Also:
Cms.MakeDetachedSig Method ( String, String, String, String, Cms.Options )
Cms.MakeDetachedSig Method ( String, String, String, String, HashAlgorithm, Cms.SigDataOptions )