2 * Copyright 2001-2006 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
20 * Signature classes for XMLSec-based signature-handling
\r
23 #if !defined(__xmltooling_xmlsecsig_h__) && !defined(XMLTOOLING_NO_XMLSEC)
\r
24 #define __xmltooling_xmlsecsig_h__
\r
26 #include "internal.h"
\r
27 #include "impl/UnknownElement.h"
\r
28 #include "signature/Signature.h"
\r
29 #include "util/XMLConstants.h"
\r
33 #if defined (_MSC_VER)
\r
34 #pragma warning( push )
\r
35 #pragma warning( disable : 4250 4251 )
\r
38 namespace xmltooling {
\r
40 class XMLTOOL_DLLLOCAL XMLSecSignatureImpl : public UnknownElementImpl, public virtual Signature
\r
43 XMLSecSignatureImpl() : UnknownElementImpl(XMLConstants::XMLSIG_NS, Signature::LOCAL_NAME, XMLConstants::XMLSIG_PREFIX),
\r
44 m_signature(NULL), m_c14n(NULL), m_sm(NULL) {}
\r
45 virtual ~XMLSecSignatureImpl();
\r
48 XMLObject* clone() const;
\r
50 DOMElement* marshall(DOMDocument* document=NULL, MarshallingContext* ctx=NULL) const;
\r
51 DOMElement* marshall(DOMElement* parentElement, MarshallingContext* ctx=NULL) const;
\r
52 XMLObject* unmarshall(DOMElement* element, bool bindDocument=false);
\r
55 const XMLCh* getCanonicalizationMethod() const { return m_c14n ? m_c14n : DSIGConstants::s_unicodeStrURIEXC_C14N_NOC; }
\r
56 const XMLCh* getSignatureAlgorithm() const { return m_sm ? m_sm : DSIGConstants::s_unicodeStrURIRSA_SHA1; }
\r
59 void setCanonicalizationMethod(const XMLCh* c14n) { m_c14n = prepareForAssignment(m_c14n,c14n); }
\r
60 void setSignatureAlgorithm(const XMLCh* sm) { m_sm = prepareForAssignment(m_sm,sm); }
\r
62 void sign(const SigningContext& ctx);
\r
63 void verify(const VerifyingContext& ctx) const;
\r
66 mutable DSIGSignature* m_signature;
\r
71 class XMLTOOL_DLLLOCAL XMLSecSignatureBuilder : public virtual XMLObjectBuilder
\r
74 XMLSecSignatureImpl* buildObject(
\r
75 const XMLCh* namespaceURI, const XMLCh* elementLocalName, const XMLCh* namespacePrefix=NULL
\r
77 return new XMLSecSignatureImpl();
\r
83 #if defined (_MSC_VER)
\r
84 #pragma warning( pop )
\r
87 #endif /* __xmltooling_xmlsecsig_h__ */
\r