Private Function InitSignatureGenerator(ByVal compressedOut As Stream) As PgpSignatureGenerator
Const IsCritical As Boolean = False
Const IsNested As Boolean = False
Dim tag As PublicKeyAlgorithmTag = m_encryptionKeys.SecretKey.PublicKey.Algorithm
Dim pgpSignatureGenerator As New PgpSignatureGenerator(tag, HashAlgorithmTag.Sha1)
pgpSignatureGenerator.InitSign(PgpSignature.NoCertification, m_encryptionKeys.PrivateKey)
' pgpSignatureGenerator.GenerateOnePassVersion(False).Encode(compressedOut)
For Each userId As String In m_encryptionKeys.SecretKey.PublicKey.GetUserIds()
Dim subPacketGenerator As New PgpSignatureSubpacketGenerator()
subPacketGenerator.SetSignerUserId(IsCritical, userId)
pgpSignatureGenerator.SetHashedSubpackets(subPacketGenerator.Generate())
' this function i am unable to decrypt, it shows error private key not in public key ring
Next
pgpSignatureGenerator.GenerateOnePassVersion(IsNested).Encode(compressedOut)
Return pgpSignatureGenerator
End Function