X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fsignature%2FSignature.h;h=3245b7e22e727bdfc108d2f4267fdeeb64adbd8f;hb=HEAD;hp=a4d74e582d69651f111181fb91c9c32e64ce8852;hpb=5a4c9204dc299319e9ca7c18f44918a82892045a;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/signature/Signature.h b/xmltooling/signature/Signature.h index a4d74e5..3245b7e 100644 --- a/xmltooling/signature/Signature.h +++ b/xmltooling/signature/Signature.h @@ -1,21 +1,25 @@ -/* - * Copyright 2001-2007 Internet2 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + * + * UCAID licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the + * License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** - * @file Signature.h + * @file xmltooling/signature/Signature.h * * XMLObject representing XML Digital Signature, version 20020212, Signature element. */ @@ -24,11 +28,10 @@ #define __xmltooling_sig_h__ #include -#include -#include -#include +#include -#include +class DSIGSignature; +class XSECCryptoKey; /** * @namespace xmlsignature @@ -36,6 +39,7 @@ */ namespace xmlsignature { + class XMLTOOL_API ContentReference; class XMLTOOL_API KeyInfo; /** @@ -46,7 +50,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 +65,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 +93,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 +105,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 +113,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 +125,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 +143,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. @@ -194,13 +198,14 @@ namespace xmlsignature { ); 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 @@ -208,7 +213,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; /** @@ -222,21 +227,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);