-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Govind_k22
Message 3 in Discussion

Thanks Deepak,        I am using Capicom Interface Only.   Here is My code :Function 
SignData(ByVal sData As String) As String
Dim sSignedData As String
Dim MyStore As New Store()
Dim Signobj As New SignedData()
Dim Signer As New Signer()
Dim Cert As CAPICOM.Certificate
MyStore.Open(CAPICOM_STORE_LOCATION.CAPICOM_MEMORY_STORE, "MY", 
CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_READ_ONLY)
MyStore.Load("c:\inbnd\cert\gsladmin.pfx", "iwin2003") ' interworld8-11.p7b")
Cert = MyStore.Certificates.Item(1)
Signer.Certificate = Cert
Signobj.Content = sData
sSignedData = Signobj.Sign(Signer, False)
Signobj = Nothing
MyStore = Nothing
Signer = Nothing
Return sSignedDataBut I want Like these Implemented By PKCS#1. public byte[] 
Hash(string plaintext)
  {
   HashAlgorithm hashAlgo = HashAlgorithm.Create(_strHashAlgo);
   byte[] plaintextbyte = new UnicodeEncoding().GetBytes(plaintext);
   byte[] hash = hashAlgo.ComputeHash(plaintextbyte); 
   return hash;
  }  public byte[] Sign(string plaintext)
  {
   byte[] hash = Hash(plaintext);
   byte[] sign = _rsa.SignHash(hash,CryptoConfig.MapNameToOID(_strHashAlgo)); //128 
byte signature
   return sign;
  }
   
  public bool Validate(string plaintext, byte[] sign)
  {
   byte[] hash = Hash(plaintext);
   bool test = _rsa.VerifyHash(hash,CryptoConfig.MapNameToOID(_strHashAlgo),sign);
   return test;
  }Regards,Govind.  

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to