namespace xmlsignature {\r
\r
/**\r
- * Validator for signatures based on a KeyResolver\r
+ * Validator for signatures based on a Key or a KeyResolver\r
*/\r
- class XMLTOOL_API SignatureValidator : public virtual xmltooling::Validator\r
+ class XMLTOOL_API SignatureValidator : public xmltooling::Validator\r
{\r
public:\r
/**\r
- * Constructor\r
+ * Constructor using a KeyResolver\r
* \r
- * @param resolver the key resolver to use, will be freed by Validator\r
+ * @param resolver the key resolver to use, will be freed by Validator\r
*/\r
- SignatureValidator(KeyResolver* resolver) : m_resolver(resolver) {\r
+ SignatureValidator(KeyResolver* resolver) : m_key(NULL), m_resolver(resolver) {\r
+ }\r
+\r
+ /**\r
+ * Constructor using a Key\r
+ * \r
+ * @param key the verification key to use, will be freed by Validator\r
+ */\r
+ SignatureValidator(XSECCryptoKey* key=NULL) : m_key(key), m_resolver(NULL) {\r
}\r
\r
virtual ~SignatureValidator() {\r
+ delete m_key;\r
delete m_resolver;\r
}\r
\r
- void validate(const xmltooling::XMLObject* xmlObject) const;\r
+ virtual void validate(const xmltooling::XMLObject* xmlObject) const;\r
\r
virtual void validate(const Signature* signature) const;\r
\r
/**\r
+ * Replace the current Key, if any, with a new one.\r
+ * \r
+ * @param key the Key to attach \r
+ */\r
+ void setKey(XSECCryptoKey* key) {\r
+ delete m_key;\r
+ delete m_resolver;\r
+ m_resolver=NULL;\r
+ m_key=key;\r
+ }\r
+\r
+ /**\r
* Replace the current KeyResolver, if any, with a new one.\r
* \r
* @param resolver the KeyResolver to attach \r
*/\r
void setKeyResolver(KeyResolver* resolver) {\r
+ delete m_key;\r
delete m_resolver;\r
+ m_key=NULL;\r
m_resolver=resolver;\r
}\r
\r
protected:\r
+ XSECCryptoKey* m_key;\r
KeyResolver* m_resolver;\r
};\r
\r