2 * Copyright 2001-2010 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file xmltooling/signature/SignatureValidator.h
20 * Validator for signatures based on an externally-supplied key.
23 #if !defined(__xmltooling_sigval_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_sigval_h__
26 #include <xmltooling/validation/Validator.h>
30 namespace xmltooling {
31 class XMLTOOL_API Credential;
34 namespace xmlsignature {
36 class XMLTOOL_API Signature;
39 * Validator for signatures based on a Credential
41 class XMLTOOL_API SignatureValidator : public xmltooling::Validator
45 * Constructor using a key
47 * @param key the key to use
49 SignatureValidator(XSECCryptoKey* key=nullptr);
52 * Constructor using a Credential
54 * @param credential the credential to use
56 SignatureValidator(const xmltooling::Credential* credential);
58 virtual ~SignatureValidator();
60 void validate(const xmltooling::XMLObject* xmlObject) const;
63 * Type-safe validator.
65 * @param signature object to validate
67 virtual void validate(const Signature* signature) const;
70 * Replace the current key, if any, with a new one.
72 * @param key the key to attach
74 void setKey(XSECCryptoKey* key);
77 * Replace the current Credential, if any, with a new one.
79 * @param credential the Credential to attach
81 void setCredential(const xmltooling::Credential* credential);
84 /** Verification key. */
87 /** Verification credential. */
88 const xmltooling::Credential* m_credential;
93 #endif /* __xmltooling_sigval_h__ */