Migrate to xmlsec 1.3 release, shrink a few headers.
[shibboleth/cpp-opensaml.git] / samltest / signature / SAMLSignatureTestBase.h
1 /*\r
2  *  Copyright 2001-2005 Internet2\r
3  * \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
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\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
15  */\r
16 \r
17 #include "internal.h"\r
18 #include <saml/signature/SignatureProfileValidator.h>\r
19 \r
20 #include <xmltooling/signature/CredentialResolver.h>\r
21 #include <xmltooling/signature/KeyInfo.h>\r
22 #include <xmltooling/signature/SignatureValidator.h>\r
23 \r
24 using namespace xmlsignature;\r
25 \r
26 class _addcert : public std::binary_function<X509Data*,XSECCryptoX509*,void> {\r
27 public:\r
28     void operator()(X509Data* bag, XSECCryptoX509* cert) const {\r
29         safeBuffer& buf=cert->getDEREncodingSB();\r
30         X509Certificate* x=X509CertificateBuilder::buildX509Certificate();\r
31         x->setValue(buf.sbStrToXMLCh());\r
32         bag->getX509Certificates().push_back(x);\r
33     }\r
34 };\r
35 \r
36 class SAMLSignatureTestBase : public SAMLObjectBaseTestCase {\r
37 protected:\r
38     CredentialResolver* m_resolver;\r
39 public:\r
40     void setUp() {\r
41         m_resolver=NULL;\r
42         SAMLObjectBaseTestCase::setUp();\r
43         string config = data_path + "FilesystemCredentialResolver.xml";\r
44         ifstream in(config.c_str());\r
45         DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);\r
46         XercesJanitor<DOMDocument> janitor(doc);\r
47         m_resolver = XMLToolingConfig::getConfig().CredentialResolverManager.newPlugin(\r
48             FILESYSTEM_CREDENTIAL_RESOLVER,doc->getDocumentElement()\r
49             );\r
50     }\r
51 \r
52     void tearDown() {\r
53         delete m_resolver;\r
54         SAMLObjectBaseTestCase::tearDown();\r
55     }\r
56 };\r