CryptoSys PKI Pro Manual

Sig.VerifyData Method

Verify a signature value over data in a byte array.

Syntax

[C#]
public static int VerifyData(
   string sigStr,
   byte[] data,
   string certOrKeyFile,
   SigAlgorithm sigAlg,
   Sig.VerifyOpts opts = Sig.VerifyOpts.Default 
)
[VB]
Public Shared Function VerifyData (
   sigStr As String,
   data As Byte(),
   certOrKeyFile As String,
   sigAlg As SigAlgorithm,
   Optional opts As Sig.VerifyOpts = Sig.VerifyOpts.Default 
) As Integer

Parameters

sigStr  String
Encoded signature value
data  Byte
Input data to be verified
certOrKeyFile  String
The X.509 certificate or public key file name (or a string containing the certificate or key in PEM format or base64 representation, or an internal key string).
sigAlg  SigAlgorithm
Signature algorithm used to create signature.
opts  Sig.VerifyOpts  (Optional)
(optional) Advanced options for RSA-PSS only.

Return Value

Zero (0) if the signature is valid; otherwise a negative error code.

Remarks

Any valid encodings of the signature value are detected automatically.

Example

string certFile = "AliceRSASignByCarl.cer"; // Used to verify signature
// Signed data: a byte array with ASCII string "abc"
byte[] b = System.Text.Encoding.Default.GetBytes("abc");
string sig = // Alice/'abc'/SHA-1
"YK1aePtKQDDsVCyJdM0V9VOE6DZVTO3ZoyLV9BNcYmep0glwxU5mUQcLAUTUOETImTIN2Pp4Gffr" +
"xqdxUoczLshnXBNhg7P4ofge+WlBgmcTCnVv27LHHZpmdEbjTg6tnPMb+2b4FvMZ0LfkMKXyiRVTmG4A" +
"NyAmHH6QIsDZ8R8=";
int n = Sig.VerifyData(sig, b, certFile, SigAlgorithm.Default);
Console.WriteLine("Sig.VerifyData returns " + n + " (expecting 0)");
Debug.Assert(0 == n, "Sig.VerifyData failed");

See Also

VB6/C equivalent: SIG_VerifyData

[Contents] [Index]

[PREV: Sig.SignFile Method...]   [Contents]   [Index]   
   [NEXT: Sig.VerifyDigest Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-17T11:18:15Z.