X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fsignature%2FSignature.h;h=eddf54bdb923fbd7b16af70dc8a397bda2655996;hb=a0d768778a8f5f539b909baf5b115e70ea765f0f;hp=aa8db505b767b4e1e6fe90c7d3fa43d38b427811;hpb=d96a01ce4d9648bb3186f74d43610b6f12d49758;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/signature/Signature.h b/xmltooling/signature/Signature.h index aa8db50..eddf54b 100644 --- a/xmltooling/signature/Signature.h +++ b/xmltooling/signature/Signature.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /** - * @file Signature.h + * @file xmltooling/signature/Signature.h * * XMLObject representing XML Digital Signature, version 20020212, Signature element. */ @@ -24,11 +24,10 @@ #define __xmltooling_sig_h__ #include -#include -#include -#include +#include -#include +class DSIGSignature; +class XSECCryptoKey; /** * @namespace xmlsignature @@ -36,6 +35,7 @@ */ namespace xmlsignature { + class XMLTOOL_API ContentReference; class XMLTOOL_API KeyInfo; /** @@ -46,7 +46,7 @@ namespace xmlsignature { class XMLTOOL_API Signature : public virtual xmltooling::XMLObject { public: - virtual ~Signature() {} + virtual ~Signature(); /** Element local name */ static const XMLCh LOCAL_NAME[]; @@ -61,7 +61,7 @@ namespace xmlsignature { /** * Gets the signing algorithm for the signature. * - * @return the signature algorithm + * @return the signature algorithm, or nullptr if indeterminate */ virtual const XMLCh* getSignatureAlgorithm() const=0; @@ -89,7 +89,7 @@ namespace xmlsignature { /** * Sets a KeyInfo object to embed in the Signature. * - * @param keyInfo pointer to a KeyInfo object, or NULL + * @param keyInfo pointer to a KeyInfo object, or nullptr */ virtual void setKeyInfo(KeyInfo* keyInfo)=0; @@ -101,7 +101,7 @@ namespace xmlsignature { * for validation purposes is provided through the native * DSIGSignature object. * - * @return pointer to a KeyInfo object, or NULL + * @return pointer to a KeyInfo object, or nullptr */ virtual KeyInfo* getKeyInfo() const=0; @@ -109,7 +109,7 @@ namespace xmlsignature { * Sets the ContentReference object to the Signature to be applied * when the signature is created. * - * @param reference the reference to attach, or NULL + * @param reference the reference to attach, or nullptr */ virtual void setContentReference(ContentReference* reference)=0; @@ -121,7 +121,7 @@ namespace xmlsignature { * for validation purposes is provided through the native * DSIGSignature object. * - * @return pointer to a ContentReference object, or NULL + * @return pointer to a ContentReference object, or nullptr */ virtual ContentReference* getContentReference() const=0; @@ -139,7 +139,7 @@ namespace xmlsignature { * * @param credential optional source of signing key and KeyInfo */ - virtual void sign(const xmltooling::Credential* credential=NULL)=0; + virtual void sign(const xmltooling::Credential* credential=nullptr)=0; /** * Type-safe clone operation. @@ -193,22 +193,15 @@ namespace xmlsignature { unsigned int in_len ); - /** - * Populates a set of key names using the information found in a native KeyInfo object. - * - * @param keyInfo a native KeyInfo object - * @param names a set of names to populate - */ - static void extractNames(DSIGKeyInfoList* keyInfo, std::set& names); - protected: - Signature() {} + /** Default constructor. */ + Signature(); }; /** * Builder for Signature objects. */ - class XMLTOOL_API SignatureBuilder : public xmltooling::XMLObjectBuilder + class XMLTOOL_API SignatureBuilder : public xmltooling::ConcreteXMLObjectBuilder { public: #ifdef HAVE_COVARIANT_RETURNS @@ -216,7 +209,7 @@ namespace xmlsignature { #else virtual xmltooling::XMLObject* buildObject( #endif - const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr ) const; /** @@ -230,21 +223,7 @@ namespace xmlsignature { virtual xmltooling::XMLObject* buildObject() const; #endif /** Singleton builder. */ - static Signature* buildSignature() { - const SignatureBuilder* b = dynamic_cast( - xmltooling::XMLObjectBuilder::getBuilder( - xmltooling::QName(xmlconstants::XMLSIG_NS,Signature::LOCAL_NAME) - ) - ); - if (b) { -#ifdef HAVE_COVARIANT_RETURNS - return b->buildObject(); -#else - return dynamic_cast(b->buildObject()); -#endif - } - throw xmltooling::XMLObjectException("Unable to obtain typed builder for Signature."); - } + static Signature* buildSignature(); }; DECL_XMLTOOLING_EXCEPTION(SignatureException,XMLTOOL_EXCEPTIONAPI(XMLTOOL_API),xmlsignature,xmltooling::XMLSecurityException,Exceptions in signature processing);