/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef __xmltooling_absattrextxmlobj_h__
#define __xmltooling_absattrextxmlobj_h__
-#include <map>
#include <xmltooling/AbstractXMLObject.h>
#include <xmltooling/AttributeExtensibleXMLObject.h>
+#include <map>
+
#if defined (_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4250 4251 )
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file xmltooling/exceptions.h
*
- * Exception classes
+ * Exception classes.
*/
#ifndef __xmltooling_exceptions_h__
#define __xmltooling_exceptions_h__
+#include <xmltooling/base.h>
+
#include <map>
#include <string>
#include <vector>
#include <iostream>
-#include <xmltooling/base.h>
/**
* Declares a derived exception class
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* @param newEngine trust engine to add
*/
- void addTrustEngine(TrustEngine* newEngine) {
- m_engines.push_back(newEngine);
- }
+ void addTrustEngine(TrustEngine* newEngine);
/**
* Removes a trust engine. The caller must delete the engine if necessary.
* @param oldEngine trust engine to remove
* @return the old engine
*/
- TrustEngine* removeTrustEngine(TrustEngine* oldEngine) {
- for (std::vector<TrustEngine*>::iterator i=m_engines.begin(); i!=m_engines.end(); i++) {
- if (oldEngine==(*i)) {
- m_engines.erase(i);
- return oldEngine;
- }
- }
- return NULL;
- }
+ TrustEngine* removeTrustEngine(TrustEngine* oldEngine);
bool validate(
xmlsignature::Signature& sig,
#if !defined(__xmltooling_credcrit_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#define __xmltooling_credcrit_h__
-#include <xmltooling/XMLToolingConfig.h>
-#include <xmltooling/security/KeyInfoResolver.h>
-#include <xmltooling/security/Credential.h>
-#include <xmltooling/signature/KeyInfo.h>
-#include <xmltooling/signature/Signature.h>
+#include <xmltooling/base.h>
#include <set>
-#include <xsec/dsig/DSIGKeyInfoList.hpp>
-#include <xsec/dsig/DSIGKeyInfoName.hpp>
+
+class DSIGKeyInfoList;
+
+namespace xmlsignature {
+ class XMLTOOL_API KeyInfo;
+ class XMLTOOL_API Signature;
+};
namespace xmltooling {
{
MAKE_NONCOPYABLE(CredentialCriteria);
public:
- CredentialCriteria() : m_keyUsage(Credential::UNSPECIFIED_CREDENTIAL), m_keySize(0), m_key(NULL),
- m_keyInfo(NULL), m_nativeKeyInfo(NULL), m_credential(NULL) {
- }
- virtual ~CredentialCriteria() {
- delete m_credential;
- }
+ /** Default constructor. */
+ CredentialCriteria();
+
+ virtual ~CredentialCriteria();
/**
* Determines whether the supplied Credential matches this CredentialCriteria.
*
* @param algorithm XML algorithm specifier
*/
- void setXMLAlgorithm(const XMLCh* algorithm) {
- if (algorithm) {
- std::pair<const char*,unsigned int> mapped =
- XMLToolingConfig::getConfig().mapXMLAlgorithmToKeyAlgorithm(algorithm);
- setKeyAlgorithm(mapped.first);
- setKeySize(mapped.second);
- }
- else {
- setKeyAlgorithm(NULL);
- setKeySize(0);
- }
- }
+ void setXMLAlgorithm(const XMLCh* algorithm);
/**
* Gets key name criteria.
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#define __xmltooling_keyinfocredctx_h__
#include <xmltooling/security/CredentialContext.h>
-#include <xmltooling/signature/Signature.h>
-#include <xsec/dsig/DSIGKeyInfoList.hpp>
+
+class DSIGKeyInfoList;
namespace xmlsignature {
class XMLTOOL_API KeyInfo;
public:
/**
* Constructor
+ *
+ * @param keyInfo surrounding KeyInfo context object
*/
KeyInfoCredentialContext(const xmlsignature::KeyInfo* keyInfo=NULL) : m_keyInfo(keyInfo), m_nativeKeyInfo(NULL) {
}
/**
* Constructor
+ *
+ * @param keyInfo surrounding native KeyInfo context object
*/
KeyInfoCredentialContext(DSIGKeyInfoList* keyInfo) : m_keyInfo(NULL), m_nativeKeyInfo(keyInfo) {
}
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#if !defined(__xmltooling_keyres_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#define __xmltooling_keyres_h__
-#include <xmltooling/security/Credential.h>
-#include <xmltooling/security/KeyInfoCredentialContext.h>
+#include <xmltooling/base.h>
-#include <xsec/dsig/DSIGKeyInfoList.hpp>
+class DSIGKeyInfoList;
+
+namespace xmlsignature {
+ class XMLTOOL_API KeyInfo;
+ class XMLTOOL_API Signature;
+};
namespace xmltooling {
+ class XMLTOOL_API Credential;
class XMLTOOL_API CredentialCriteria;
+ class XMLTOOL_API KeyInfoCredentialContext;
/**
* Resolves credentials from KeyInfo information.
/*
- * Copyright 2001-2007 The Apache Software Foundation.
+ * Copyright 2001-2009 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file xmltooling/security/OpenSSLCryptoX509CRL.h
*
- * OpenSSL-based class for handling X.509 CRLs
+ * OpenSSL-based class for handling X.509 CRLs.
*/
#if !defined(__xmltooling_opensslx509crl_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#include <xmltooling/security/XSECCryptoX509CRL.h>
-#include <openssl/bio.h>
#include <openssl/x509v3.h>
#include <xsec/utils/XSECSafeBuffer.hpp>
*/
class XMLTOOL_API OpenSSLCryptoX509CRL : public XSECCryptoX509CRL {
public:
+ /** Default constructor. */
OpenSSLCryptoX509CRL() : mp_X509CRL(NULL), m_DERX509CRL("") {}
virtual ~OpenSSLCryptoX509CRL();
- virtual const XMLCh* getProviderName() const {
+ const XMLCh* getProviderName() const {
return DSIGConstants::s_unicodeStrPROVOpenSSL;
}
- virtual void loadX509CRLBase64Bin(const char* buf, unsigned int len);
- virtual safeBuffer& getDEREncodingSB(void) {
+ void loadX509CRLBase64Bin(const char* buf, unsigned int len);
+ safeBuffer& getDEREncodingSB(void) {
return m_DERX509CRL;
}
return mp_X509CRL;
}
- XSECCryptoX509CRL* clone() const {
- OpenSSLCryptoX509CRL* copy = new OpenSSLCryptoX509CRL();
- copy->mp_X509CRL = X509_CRL_dup(mp_X509CRL);
- copy->m_DERX509CRL = m_DERX509CRL;
- return copy;
- }
+ XSECCryptoX509CRL* clone() const;
private:
X509_CRL* mp_X509CRL;
#if !defined(__xmltooling_sechelper_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#define __xmltooling_sechelper_h__
-#include <xmltooling/security/XSECCryptoX509CRL.h>
-#include <xmltooling/soap/SOAPTransport.h>
+#include <xmltooling/base.h>
#include <vector>
-#include <xsec/enc/XSECCryptoKey.hpp>
-#include <xsec/enc/XSECCryptoX509.hpp>
+
+class XSECCryptoKey;
+class XSECCryptoX509;
namespace xmltooling {
class XMLTOOL_API Credential;
+ class XMLTOOL_API SOAPTransport;
+ class XMLTOOL_API XSECCryptoX509CRL;
/**
* A helper class for working with keys, certificates, etc.
#include "logging.h"
#include "security/AbstractPKIXTrustEngine.h"
#include "signature/KeyInfo.h"
+#include "signature/Signature.h"
#include <openssl/x509_vfy.h>
#include <openssl/x509v3.h>
#include "util/NDC.h"
#include "util/XMLHelper.h"
+#include <algorithm>
#include <xercesc/util/XMLUniDefs.hpp>
using namespace xmltooling::logging;
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* ChainingTrustEngine.cpp
*
- * TrustEngine that uses multiple engines in sequence.
+ * OpenSSLTrustEngine that uses multiple engines in sequence.
*/
#include "internal.h"
#include "security/ChainingTrustEngine.h"
#include "util/XMLHelper.h"
+#include <algorithm>
#include <xercesc/util/XMLUniDefs.hpp>
using namespace xmlsignature;
for_each(m_engines.begin(), m_engines.end(), xmltooling::cleanup<TrustEngine>());
}
+void ChainingTrustEngine::addTrustEngine(TrustEngine* newEngine)
+{
+ m_engines.push_back(newEngine);
+}
+
+TrustEngine* ChainingTrustEngine::removeTrustEngine(TrustEngine* oldEngine)
+{
+ for (vector<TrustEngine*>::iterator i=m_engines.begin(); i!=m_engines.end(); i++) {
+ if (oldEngine==(*i)) {
+ m_engines.erase(i);
+ return oldEngine;
+ }
+ }
+ return NULL;
+}
+
bool ChainingTrustEngine::validate(Signature& sig, const CredentialResolver& credResolver, CredentialCriteria* criteria) const
{
for (vector<SignatureTrustEngine*>::const_iterator i=m_sigEngines.begin(); i!=m_sigEngines.end(); ++i) {
#include "internal.h"
#include "logging.h"
+#include "XMLToolingConfig.h"
#include "security/X509Credential.h"
#include "security/CredentialCriteria.h"
#include "security/KeyInfoResolver.h"
#include "security/SecurityHelper.h"
+#include "signature/Signature.h"
#include <openssl/dsa.h>
#include <openssl/rsa.h>
+#include <xsec/dsig/DSIGKeyInfoList.hpp>
#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyDSA.hpp>
#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp>
using namespace xmltooling;
using namespace std;
+CredentialCriteria::CredentialCriteria()
+ : m_keyUsage(Credential::UNSPECIFIED_CREDENTIAL), m_keySize(0), m_key(NULL),
+ m_keyInfo(NULL), m_nativeKeyInfo(NULL), m_credential(NULL)
+{
+}
+
+CredentialCriteria::~CredentialCriteria()
+{
+ delete m_credential;
+}
+
+void CredentialCriteria::setXMLAlgorithm(const XMLCh* algorithm)
+{
+ if (algorithm) {
+ pair<const char*,unsigned int> mapped = XMLToolingConfig::getConfig().mapXMLAlgorithmToKeyAlgorithm(algorithm);
+ setKeyAlgorithm(mapped.first);
+ setKeySize(mapped.second);
+ }
+ else {
+ setKeyAlgorithm(NULL);
+ setKeySize(0);
+ }
+}
+
void CredentialCriteria::setKeyInfo(const xmlsignature::KeyInfo* keyInfo, int extraction)
{
delete m_credential;
#include "security/CredentialResolver.h"
#include "security/OpenSSLTrustEngine.h"
#include "security/SignatureTrustEngine.h"
+#include "signature/Signature.h"
#include "signature/SignatureValidator.h"
#include "util/NDC.h"
/*
- * Copyright 2001-2007 The Apache Software Foundation.
+ * Copyright 2001-2009 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* OpenSSLCryptoX509CRL.cpp
*
- * OpenSSL-based class for handling X.509 CRLs
+ * OpenSSL-based class for handling X.509 CRLs.
*/
#include "internal.h"
m_DERX509CRL.sbStrcpyIn(buf);
}
+
+XSECCryptoX509CRL* OpenSSLCryptoX509CRL::clone() const
+{
+ OpenSSLCryptoX509CRL* copy = new OpenSSLCryptoX509CRL();
+ copy->mp_X509CRL = X509_CRL_dup(mp_X509CRL);
+ copy->m_DERX509CRL = m_DERX509CRL;
+ return copy;
+}
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file xmltooling/signature/ContentReference.h
*
- * Interface for creating signature references
+ * Interface for creating signature references.
*/
#if !defined(__xmltooling_sigref_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#define __xmltooling_sigref_h__
-#include <vector>
-#include <xsec/dsig/DSIGSignature.hpp>
+#include <xmltooling/base.h>
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4250 4251 )
-#endif
+class DSIGSignature;
namespace xmlsignature {
-
/**
* Interface for creating signature references based on application requirements.
*/
virtual void createReferences(DSIGSignature* sig)=0;
protected:
+ /** Default constructor. */
ContentReference() {}
};
-
};
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
-
#endif /* __xmltooling_sigref_h__ */
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <xmltooling/ConcreteXMLObjectBuilder.h>
#include <xmltooling/exceptions.h>
-#include <xmltooling/signature/ContentReference.h>
-#include <xmltooling/util/XMLConstants.h>
-#include <xsec/dsig/DSIGSignature.hpp>
+class DSIGSignature;
+class XSECCryptoKey;
/**
* @namespace xmlsignature
*/
namespace xmlsignature {
+ class XMLTOOL_API ContentReference;
class XMLTOOL_API KeyInfo;
/**
);
protected:
+ /** 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
virtual xmltooling::XMLObject* buildObject() const;
#endif
/** Singleton builder. */
- static Signature* buildSignature() {
- const SignatureBuilder* b = dynamic_cast<const SignatureBuilder*>(
- xmltooling::XMLObjectBuilder::getBuilder(
- xmltooling::QName(xmlconstants::XMLSIG_NS,Signature::LOCAL_NAME)
- )
- );
- if (b) {
-#ifdef HAVE_COVARIANT_RETURNS
- return b->buildObject();
-#else
- return dynamic_cast<Signature*>(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);
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#if !defined(__xmltooling_sigval_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#define __xmltooling_sigval_h__
-#include <xmltooling/security/Credential.h>
-#include <xmltooling/signature/Signature.h>
#include <xmltooling/validation/Validator.h>
+class XSECCryptoKey;
+
+namespace xmltooling {
+ class XMLTOOL_API Credential;
+};
+
namespace xmlsignature {
+ class XMLTOOL_API Signature;
+
/**
* Validator for signatures based on a Credential
*/
*
* @param key the key to use
*/
- SignatureValidator(XSECCryptoKey* key=NULL) : m_key(key), m_credential(NULL) {}
+ SignatureValidator(XSECCryptoKey* key=NULL);
/**
* Constructor using a Credential
*
* @param credential the credential to use
*/
- SignatureValidator(const xmltooling::Credential* credential) : m_key(NULL), m_credential(credential) {}
+ SignatureValidator(const xmltooling::Credential* credential);
virtual ~SignatureValidator() {}
- virtual void validate(const xmltooling::XMLObject* xmlObject) const;
+ void validate(const xmltooling::XMLObject* xmlObject) const;
/**
* Type-safe validator.
*
* @param key the key to attach
*/
- void setKey(XSECCryptoKey* key) {
- m_key = key;
- m_credential = NULL;
- }
+ void setKey(XSECCryptoKey* key);
/**
* Replace the current Credential, if any, with a new one.
*
* @param credential the Credential to attach
*/
- void setCredential(const xmltooling::Credential* credential) {
- m_key = NULL;
- m_credential = credential;
- }
+ void setCredential(const xmltooling::Credential* credential);
protected:
/** Verification key. */
*/
#include "internal.h"
+#include "security/Credential.h"
+#include "signature/Signature.h"
#include "signature/SignatureValidator.h"
#include <xsec/enc/XSECCryptoException.hpp>
using namespace xmltooling;
using namespace std;
+SignatureValidator::SignatureValidator(XSECCryptoKey* key) : m_key(key), m_credential(NULL)
+{
+}
+
+SignatureValidator::SignatureValidator(const Credential* credential) : m_key(NULL), m_credential(credential)
+{
+}
+
+void SignatureValidator::setKey(XSECCryptoKey* key)
+{
+ m_key = key;
+ m_credential = NULL;
+}
+
+void SignatureValidator::setCredential(const Credential* credential)
+{
+ m_key = NULL;
+ m_credential = credential;
+}
+
void SignatureValidator::validate(const XMLObject* xmlObject) const
{
const Signature* sigObj=dynamic_cast<const Signature*>(xmlObject);
/*
-* Copyright 2001-2007 Internet2
+* Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "logging.h"
#include "impl/UnknownElement.h"
#include "security/Credential.h"
+#include "signature/ContentReference.h"
#include "signature/KeyInfo.h"
#include "signature/Signature.h"
#include "util/NDC.h"
return new XMLSecSignatureImpl();
}
+Signature* SignatureBuilder::buildSignature() {
+ const SignatureBuilder* b = dynamic_cast<const SignatureBuilder*>(
+ XMLObjectBuilder::getBuilder(xmltooling::QName(xmlconstants::XMLSIG_NS,Signature::LOCAL_NAME))
+ );
+ if (b) {
+#ifdef HAVE_COVARIANT_RETURNS
+ return b->buildObject();
+#else
+ return dynamic_cast<Signature*>(b->buildObject());
+#endif
+ }
+ throw XMLObjectException("Unable to obtain typed builder for Signature.");
+}
+
const XMLCh Signature::LOCAL_NAME[] = UNICODE_LITERAL_9(S,i,g,n,a,t,u,r,e);
// Raw signature methods.
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef __xmltooling_ndc_h__
#define __xmltooling_ndc_h__
-#include <string>
#include <xmltooling/base.h>
+#include <string>
+
namespace xmltooling {
/**
*/
class XMLTOOL_API NDC
{
+ MAKE_NONCOPYABLE(NDC);
public:
/**
* Constructor pushes logging context onto diagnostic stack
* Destructor pops context off of diagnostic stack
*/
~NDC();
-
- MAKE_NONCOPYABLE(NDC);
};
};
setCfgDir("/etc");
}
+bool PathResolver::isAbsolute(const char* s) const
+{
+ switch (*s) {
+ case '/':
+ case '\\':
+ return true;
+ case '.':
+ return (*(s+1) == '.' || *(s+1) == '/' || *(s+1) == '\\');
+ }
+ return *(s+1) == ':';
+}
+
const string& PathResolver::resolve(string& s, file_type_t filetype, const char* pkgname, const char* prefix) const
{
if (!isAbsolute(s.c_str())) {
virtual const std::string& resolve(std::string& s, file_type_t filetype, const char* pkgname=NULL, const char* prefix=NULL) const;
private:
- bool isAbsolute(const char* s) const {
- switch (*s) {
- case '/':
- case '\\':
- return true;
- case '.':
- return (*(s+1) == '.' || *(s+1) == '/' || *(s+1) == '\\');
- }
- return *(s+1) == ':';
- }
+ bool isAbsolute(const char* s) const;
std::string m_defaultPackage,m_defaultPrefix,m_lib,m_log,m_xml,m_run,m_cfg;
};
static const XMLCh reloadInterval[] = UNICODE_LITERAL_14(r,e,l,o,a,d,I,n,t,e,r,v,a,l);\r
static const XMLCh backingFilePath[] = UNICODE_LITERAL_15(b,a,c,k,i,n,g,F,i,l,e,P,a,t,h);\r
\r
+
+ReloadableXMLFile::~ReloadableXMLFile()
+{
+ delete m_lock;
+}
+\r
ReloadableXMLFile::ReloadableXMLFile(const DOMElement* e, Category& log)\r
: m_root(e), m_local(true), m_validate(false), m_filestamp(0), m_reloadInterval(0), m_lock(NULL), m_log(log)\r
{\r
m_lock->rdlock();\r
return this;\r
}\r
+\r
+void ReloadableXMLFile::unlock()
+{
+ if (m_lock)
+ m_lock->unlock();
+}
+\r
+pair<bool,DOMElement*> ReloadableXMLFile::load()
+{
+ return load(false);
+}
#include <xmltooling/logging.h>
#include <xmltooling/Lockable.h>
-#include <xmltooling/util/Threads.h>
#include <ctime>
#include <string>
namespace xmltooling {
+ class XMLTOOL_API RWLock;
+
/**
* Base class for file-based XML configuration.
*/
class XMLTOOL_API ReloadableXMLFile : protected virtual Lockable
{
- MAKE_NONCOPYABLE(ReloadableXMLFile);
-
+ MAKE_NONCOPYABLE(ReloadableXMLFile);
protected:
/**
* Constructor taking a DOM element supporting the following content:
*/
ReloadableXMLFile(const xercesc::DOMElement* e, logging::Category& log);
- virtual ~ReloadableXMLFile() {
- delete m_lock;
- }
+ virtual ~ReloadableXMLFile();
/**
* Loads configuration material.
* @return a pair consisting of a flag indicating whether to take ownership of
* the document, and the root element of the tree to load
*/
- virtual std::pair<bool,xercesc::DOMElement*> load() {
- return load(false);
- }
+ virtual std::pair<bool,xercesc::DOMElement*> load();
/** Root of the original DOM element passed into constructor. */
const xercesc::DOMElement* m_root;
public:
Lockable* lock();
-
- void unlock() {
- if (m_lock)
- m_lock->unlock();
- }
+ void unlock();
private:
std::pair<bool,xercesc::DOMElement*> load(bool backup);
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "internal.h"
#include "util/ReplayCache.h"
+#include "util/StorageService.h"
using namespace xmltooling;
using namespace std;
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#if !defined(__xmltooling_replay_h__) && !defined(XMLTOOLING_LITE)
#define __xmltooling_replay_h__
-#include <xmltooling/util/StorageService.h>
+#include <xmltooling/base.h>
namespace xmltooling {
+ class XMLTOOL_API StorageService;
+
/**
* Helper class on top of StorageService for detecting message replay.
*/
class XMLTOOL_API ReplayCache
{
- MAKE_NONCOPYABLE(ReplayCache);
+ MAKE_NONCOPYABLE(ReplayCache);
public:
/**
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @file xmltooling/util/StorageService.h
*
- * Generic data storage interface
+ * Generic data storage interface.
*/
#if !defined(__xmltooling_storage_h__) && !defined(XMLTOOLING_LITE)
#define __xmltooling_storage_h__
-#include <xmltooling/XMLObject.h>
+#include <xmltooling/base.h>
#include <ctime>
*/
#include "internal.h"
+#include "io/GenericRequest.h"
#include "util/TemplateEngine.h"
using namespace xmltooling;
static const pair<const string,string> emptyPair;
}
+const char* TemplateEngine::TemplateParameters::getParameter(const char* name) const
+{
+ map<string,string>::const_iterator i=m_map.find(name);
+ return (i!=m_map.end() ? i->second.c_str() : (m_request ? m_request->getParameter(name) : NULL));
+}
+
+const multimap<string,string>* TemplateEngine::TemplateParameters::getLoopCollection(const char* name) const
+{
+ map< string,multimap<string,string> >::const_iterator i=m_collectionMap.find(name);
+ return (i!=m_collectionMap.end() ? &(i->second) : NULL);
+}
+
void TemplateEngine::setTagPrefix(const char* tagPrefix)
{
keytag = string("<") + tagPrefix + " ";
#ifndef __xmltooling_template_h__
#define __xmltooling_template_h__
-#include <xmltooling/io/GenericRequest.h>
+#include <xmltooling/base.h>
#include <map>
#include <string>
namespace xmltooling {
+ class XMLTOOL_API GenericRequest;
+
/**
* Simple template replacement engine. Supports the following:
* <ul>
*/
class XMLTOOL_API TemplateEngine
{
- MAKE_NONCOPYABLE(TemplateEngine);
+ MAKE_NONCOPYABLE(TemplateEngine);
public:
+ /** Default constructor. */
TemplateEngine() {
setTagPrefix("mlp");
}
* Allows callers to supply a more dynamic lookup mechanism to supplement a basic map.
*/
class XMLTOOL_API TemplateParameters {
- // MAKE_NONCOPYABLE(TemplateParameters);
public:
TemplateParameters() : m_request(NULL) {}
virtual ~TemplateParameters() {}
* @param name name of parameter
* @return value of parameter, or NULL
*/
- virtual const char* getParameter(const char* name) const {
- std::map<std::string,std::string>::const_iterator i=m_map.find(name);
- return (i!=m_map.end() ? i->second.c_str() : (m_request ? m_request->getParameter(name) : NULL));
- }
+ virtual const char* getParameter(const char* name) const;
/**
* Returns a named collection of sub-parameters to pass into a loop.
* @param name name of sub-collection
* @return pointer to a multimap of sub-parameters, or NULL
*/
- virtual const std::multimap<std::string,std::string>* getLoopCollection(const char* name) const {
- std::map< std::string,std::multimap<std::string,std::string> >::const_iterator i=m_collectionMap.find(name);
- return (i!=m_collectionMap.end() ? &(i->second) : NULL);
- }
+ virtual const std::multimap<std::string,std::string>* getLoopCollection(const char* name) const;
};
/**
#ifndef _xmltooling_threads_h
#define _xmltooling_threads_h
-#include <xmltooling/base.h>
#include <xmltooling/exceptions.h>
#include <signal.h>
}
return ret;
}
+
+bool URLEncoder::isBad(char ch) const
+{
+ static char badchars[]="=&/?:\"\\+<>#%{}|^~[],`;@";
+ return (ch<=0x20 || ch>=0x7F || strchr(badchars,ch));
+}
/**
* @file xmltooling/util/URLEncoder.h
*
- * Interface to a URL-encoding mechanism along with a
- * default implementation.
+ * Interface to a URL-encoding mechanism along with a default implementation.
*/
#ifndef __xmltool_urlenc_h__
class XMLTOOL_API URLEncoder {
MAKE_NONCOPYABLE(URLEncoder);
public:
+ /** Default constructor. */
URLEncoder() {}
+
virtual ~URLEncoder() {}
/**
* @param ch the character to check
* @return true iff the character should be encoded
*/
- virtual bool isBad(char ch) const {
- static char badchars[]="=&/?:\"\\+<>#%{}|^~[],`;@";
- return (ch<=0x20 || ch>=0x7F || strchr(badchars,ch));
- }
+ virtual bool isBad(char ch) const;
};
};
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "internal.h"
#include "exceptions.h"
+#include "QName.h"
+#include "XMLObject.h"
#include "util/XMLHelper.h"
#include "util/XMLConstants.h"
XercesJanitor<DOMLSSerializer> janitor(serializer);
if (pretty && serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, pretty))
serializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, pretty);
- DOMLSOutput *theOutput = static_cast<DOMImplementationLS*>(impl)->createLSOutput();\r
- XercesJanitor<DOMLSOutput> j_theOutput(theOutput);\r
- theOutput->setEncoding(UTF8);\r
+ DOMLSOutput *theOutput = static_cast<DOMImplementationLS*>(impl)->createLSOutput();
+ XercesJanitor<DOMLSOutput> j_theOutput(theOutput);
+ theOutput->setEncoding(UTF8);
theOutput->setByteStream(&target);
if (!serializer->write(n, theOutput))
throw XMLParserException("unable to serialize XML");
XercesJanitor<DOMLSSerializer> janitor(serializer);
if (pretty && serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, pretty))
serializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, pretty);
- DOMLSOutput *theOutput = static_cast<DOMImplementationLS*>(impl)->createLSOutput();\r
- XercesJanitor<DOMLSOutput> j_theOutput(theOutput);\r
- theOutput->setEncoding(UTF8);\r
+ DOMLSOutput *theOutput = static_cast<DOMImplementationLS*>(impl)->createLSOutput();
+ XercesJanitor<DOMLSOutput> j_theOutput(theOutput);
+ theOutput->setEncoding(UTF8);
theOutput->setByteStream(&target);
if (!serializer->write(n, theOutput))
throw XMLParserException("unable to serialize XML");
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef __xmltooling_xmlhelper_h__
#define __xmltooling_xmlhelper_h__
-#include <xmltooling/XMLObject.h>
-#include <xercesc/dom/DOM.hpp>
+#include <xmltooling/base.h>
#include <iostream>
+#include <xercesc/dom/DOM.hpp>
namespace xmltooling {
+ class XMLTOOL_API QName;
+ class XMLTOOL_API XMLObject;
+
/**
* RAII wrapper for Xerces resources.
*/
#include <xmltooling/security/SecurityHelper.h>
+#include <xsec/enc/XSECCryptoKey.hpp>
+#include <xsec/enc/XSECCryptoX509.hpp>
+
class SecurityHelperTest : public CxxTest::TestSuite {
vector<XSECCryptoX509*> certs;
/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <xmltooling/security/Credential.h>
#include <xmltooling/security/CredentialCriteria.h>
#include <xmltooling/security/CredentialResolver.h>
+#include <xmltooling/signature/ContentReference.h>
#include <xmltooling/signature/KeyInfo.h>
#include <xmltooling/signature/SignatureValidator.h>
#include <fstream>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xsec/dsig/DSIGReference.hpp>
+#include <xsec/dsig/DSIGSignature.hpp>
class TestContext : public ContentReference
{