CryptoSys PKI Pro Manual

Example: Cms.MakeDetachedSig  Rsa.ReadPrivateKey 

[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.p8e"
strCertFile = "AliceRSASignByCarl.cer"
strOutFile = "DetSignByAlice.bin"
strHexDigest = "406aec085279ba6e16022d9e0629c0229687dd48"

' First, Alice reads her private key into a string
strPrivateKey = Rsa.ReadPrivateKey(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, HashAlgorithm.Sha1, 0)
Console.WriteLine("CMS_MakeDetachedSig returns " & nRet)

See Also:
Cms.MakeDetachedSig Method

[Contents] [Index]

[PREV: Example: Cms.GetSigDataDigest ...]   [Contents]   [Index]   
   [NEXT: Example: Cms.MakeEnvData ...]

Copyright © 2004-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-09-18T10:02:53Z.