CryptoSys PKI Pro Manual

SIG_VerifyFile

Verify a signature value over data in a file.

VBA/VB6 Syntax

Public Declare Function SIG_VerifyFile Lib "diCrPKI.dll" (ByVal strSignature As String, ByVal strDataFile As String, ByVal strCertOrKeyFile As String, ByVal strAlgName As String, ByVal nOptions As Long) As Long

nRet = SIG_VerifyFile(strSignature, strDataFile, strCertOrKeyFile, strAlgName, nOptions)

C/C++ Syntax

long __stdcall SIG_VerifyFile(const char *szSignature, const char *szDataFile, const char *szCertOrKeyFile, const char *szAlgName, long nOptions);

Parameters

szSignature
[in] string containing the signature value encoded in base64.
szDataFile
[in] specifying the file containing the input data to be verified.
szCertOrKeyFile
[in] specifying the X.509 certificate or public key file (or a string containing the certificate or key in PEM format or base64 representation).
szAlgName
[in] specifying the signature algorithm (case insensitive):
"sha1WithRSAEncryption" (default)
"sha224WithRSAEncryption"
"sha256WithRSAEncryption"
"sha384WithRSAEncryption"
"sha512WithRSAEncryption"
"md5WithRSAEncryption" [for legacy applications - not recommended for new implementations]
"ecdsaWithSHA1"
"ecdsaWithSHA224"
"ecdsaWithSHA256"
"ecdsaWithSHA384"
"ecdsaWithSHA512"
"RSA-PSS-SHA1"
"RSA-PSS-SHA224"
"RSA-PSS-SHA256"
"RSA-PSS-SHA384"
"RSA-PSS-SHA512"
(Note that Ed25519 and Ed448 are not available with this function - see Remarks)
or "" to use the signature algorithm flag in nOptions, see Specifying the signature algorithm in a SIG_ function.
nOptions
[in] Zero (0) for defaults.
PKI_MGF_MGF1SHA1 (RSA-PSS only) to force the MGF hash function to be SHA-1 (default = same as signature hash algorithm).

Returns (VBA/C)

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

.NET Equivalent

Sig.VerifyFile Method

C++ (STL) Equivalent

static bool dipki::Sig::VerifyFile (const std::string &sigStr, const std::string &dataFile, const std::string &certOrKey, Alg alg=Alg::Default, VerifyOpts opts=VerifyOpts::Default)

Python Equivalent

static Sig.file_is_verified(sig, datafile, certorkey, alg, verifyopts=VerifyOpts.DEFAULT)

Remarks

This function is identical to SIG_VerifyData except the data to be verified is in a file.

The Ed25519 and Ed448 signature algorithms are not available with this function. To verify using Ed25519 or Ed448, read in the file to a byte array and use SIG_VerifyData.

Example

Dim strSignature As String
Dim strDataFile As String
Dim strCertFile As String
Dim strAlgName As String
Dim nRet As Long

' Signature to be verified
strSignature = _
"tLy6hJadL4w9JI/A/qLCG0Vz1fWPIrPMWD8NGmA5wP7HHlUID54elztUYrpdm9RFeh0RCMJ618dw" & _
"BpgIutuZg2qQ2i9uMUYB0DvZvkyeD6MqmtVa4ihgc9SLqhigKeP+KB7voEi7PH3hpEr9Wa3kn4mb" & _
"PpeD1VHSzgu/qirjOaA="
' File to be verified against signature = three-character ASCII string "abc"
strDataFile = "abc.txt"
strCertFile = "AliceRSASignByCarl.cer"
strAlgName = "sha256WithRSAEncryption"
' Verify the signature over the data in the file...
nRet = SIG_VerifyFile(strSignature, strDataFile, strCertFile, strAlgName, 0)
Debug.Print "SIG_VerifyFile returns " & nRet & " (expecting 0)"
SIG_VerifyFile returns 0 (expecting 0)

See Also

SIG_VerifyData

[Contents] [Index]

[PREV: SIG_VerifyData...]   [Contents]   [Index]   
   [NEXT: SMIME_Extract...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.