2 * Copyright 2001-2007 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/security/Credential.h>
27 #include <xmltooling/signature/Signature.h>
28 #include <xmltooling/validation/Validator.h>
30 namespace xmlsignature {
33 * Validator for signatures based on a Credential
35 class XMLTOOL_API SignatureValidator : public xmltooling::Validator
39 * Constructor using a key
41 * @param key the key to use
43 SignatureValidator(XSECCryptoKey* key=NULL) : m_key(key), m_credential(NULL) {}
46 * Constructor using a Credential
48 * @param credential the credential to use
50 SignatureValidator(const xmltooling::Credential* credential) : m_key(NULL), m_credential(credential) {}
52 virtual ~SignatureValidator() {}
54 virtual void validate(const xmltooling::XMLObject* xmlObject) const;
57 * Type-safe validator.
59 * @param signature object to validate
61 virtual void validate(const Signature* signature) const;
64 * Replace the current key, if any, with a new one.
66 * @param key the key to attach
68 void setKey(XSECCryptoKey* key) {
74 * Replace the current Credential, if any, with a new one.
76 * @param credential the Credential to attach
78 void setCredential(const xmltooling::Credential* credential) {
80 m_credential = credential;
84 /** Verification key. */
87 /** Verification credential. */
88 const xmltooling::Credential* m_credential;
93 #endif /* __xmltooling_sigval_h__ */