methodiSigned.CheckSignature
function CheckSignature(aCACert: iSigned; aState : tSignedVerificationState = svsStateful) : Boolean; overload;
Verifies this object's signature against the issuer public key carried by aCACert (a CA certificate for a cert/CRL, or the request's own key for a self-signed CSR -- pass nil/Self to self-verify). Use this on the verifier side: a TLS/S/MIME client validating a received certificate, or a CA checking a CSR before issuing. Pre-checks run first: algorithm support, and for a certificate its issuer, its extensions and whether its validity lies inside the issuer's (see BeforeVerify). Expiry is not one of them. aState decides what a problem found there does. svsFullVerification: the signature is not examined and the result is False. svsVerifySignatureOnly: the pre-checks still run and record what they find, but the signature is examined anyway and the result is its verdict alone; a subclass can still prevent that, as tCertificate does when aCACert is not the issuer. svsStateful: as svsFullVerification until a call on this object, since it was last loaded or ClearErrors was called, has found problems, and as svsVerifySignatureOnly after that. A stateful call through this overload or the next one also starts from ErrorCodes: what the stateful calls before it recorded counts as problems already found (see the aErrorCodes overload), and what it finds is added. Before checking the object against another issuer certificate, call ClearErrors - or ask with svsFullVerification or svsVerifySignatureOnly, which neither read nor change what stateful calls have recorded. A FALSE DOES NOT BY ITSELF SAY THE SIGNATURE IS BAD. When a pre-check stopped the check, pcvInvalidSignature is absent from ErrorCodes; to learn whether the signature itself holds, call again with svsVerifySignatureOnly, or repeat the stateful call. This overload reports only pass/fail; read ErrorMsg/ErrorCodes afterwards for the reason. Whatever aState says, a signature made over MD2, MD5 or SHA-1 is refused with pcvUnsupportedHashAlgorithm unless the object is checked against itself - see SelectSignatureHashFloor.
function CheckSignature(aCACert : iSigned; var aErrorMsg: string; aState : tSignedVerificationState = svsStateful) : Boolean; overload;
Same verification as above, but returns the human-readable failure reason in aErrorMsg so you can log or display why a certificate/CRL/CSR was rejected without touching the cached ErrorMsg property. A stateful call starts from ErrorCodes and records its codes there, as above.
function CheckSignature(aCACert : iSigned; var aErrorCodes: tPkixCertVerificationErrors; aState : tSignedVerificationState = svsStateful) : Boolean; overload;
Same verification, returning the machine-readable error set in aErrorCodes so an application can branch on the specific fault (e.g. unsupported algorithm vs. bad signature) rather than parse a string. aErrorCodes MUST BE INITIALISED BY THE CALLER - normally to [] - since a local set is not initialised by the compiler. The method only ADDS codes, and it counts codes already in the set as problems already found: under svsFullVerification, and on a stateful call before this object has found problems, a set that is not empty on entry stops the signature from being examined, exactly as a failing pre-check does, and the result is False without pcvInvalidSignature. Under svsVerifySignatureOnly the signature is examined regardless, so True can come back with codes in the set. (A subclass may add codes in BeforeVerify before the check for the same effect, which is the intended use of that hook.) A stateful call records the resulting set in ErrorCodes, and its message in ErrorMsg.
function CheckSignature(aCACert : iSigned; var aErrorMsg : string; var aErrorCodes: tPkixCertVerificationErrors; aState : tSignedVerificationState = svsStateful) : Boolean; overload;
Same verification, returning both the human-readable message and the machine-readable error set. Use when you need to both display and act on the exact verification fault. aErrorMsg is replaced on entry; aErrorCodes is added to, and must be initialised by the caller - see above. This overload leaves the ErrorMsg and ErrorCodes properties alone, though a stateful call through it still counts towards svsStateful.