Xceed Encryption Library Documentation
Examples / Signing and verifying data entirely in memory (C# example)
In This Topic
    Signing and verifying data entirely in memory (C# example)
    In This Topic
    C# Copy Code

    XceedEncryptionLib.XceedSigning signer = new XceedEncryptionLib.XceedSigningClass();

    signer.License( @"your license key" );      

    try
    {
      XceedEncryptionLib.XceedRSASigningMethod rsa = new XceedEncryptionLib.XceedRSASigningMethodClass(); 

      // The following call to SetRandomKeyPair would, in the real world,
      // be replaced by the assignment of a Private Key to the PrivateKey property.
      object seed = null;

      rsa.SetRandomKeyPair( 512, ref seed ); 

      // Set the signing method type
      signer.SigningMethod = rsa; 

      object source = "This is the data to sign";
      signer.Sign( ref source, true ); 

      // Fetch the signature
      object signature = rsa.get_Signature(); 

      // Verify the signature
      signer.Verify( ref source, true );
    }
    catch( System.Runtime.InteropServices.COMException except )
    {
      MessageBox.Show( except.ToString() );
    }