#include <vector>\r
\r
namespace xmlsignature {\r
+ class XMLTOOL_API Signature;\r
\r
/**\r
* An API for resolving keys. The default/simple implementation\r
}\r
\r
/**\r
+ * Returns a key based on the supplied KeyInfo information.\r
+ * The caller must delete the key when done with it.\r
+ * \r
+ * @param sig signature containing the key information\r
+ * @return the resolved key\r
+ */\r
+ XSECCryptoKey* resolveKey(const Signature* sig) const;\r
+\r
+ /**\r
* A wrapper that handles disposal of certificates when required.\r
*/\r
class XMLTOOL_API ResolvedCertificates {\r
) const;\r
\r
/**\r
+ * Returns a set of certificates based on the supplied KeyInfo information.\r
+ * The certificates must be cloned if kept beyond the lifetime of the KeyInfo source.\r
+ * \r
+ * @param sig signature containing the key information\r
+ * @param certs reference to object to hold certificates\r
+ * @return number of certificates returned\r
+ */\r
+ std::vector<XSECCryptoX509*>::size_type resolveCertificates(\r
+ const Signature* sig, ResolvedCertificates& certs\r
+ ) const;\r
+\r
+ /**\r
* Returns a CRL based on the supplied KeyInfo information.\r
* The caller must delete the CRL when done with it.\r
* \r
*/\r
virtual xmltooling::XSECCryptoX509CRL* resolveCRL(DSIGKeyInfoList* keyInfo) const;\r
\r
+ /**\r
+ * Returns a CRL based on the supplied KeyInfo information.\r
+ * The caller must delete the CRL when done with it.\r
+ * \r
+ * @param sig signature containing the key information\r
+ * @return the resolved CRL\r
+ */\r
+ xmltooling::XSECCryptoX509CRL* resolveCRL(const Signature* sig) const;\r
+\r
protected:\r
XSECCryptoKey* m_key;\r
\r
#include "internal.h"
#include "signature/KeyResolver.h"
+#include "signature/Signature.h"
using namespace xmlsignature;
using namespace xmltooling;
conf.KeyResolverManager.registerFactory(INLINE_KEY_RESOLVER, InlineKeyResolverFactory);
}
+XSECCryptoKey* KeyResolver::resolveKey(const Signature* sig) const
+{
+ const KeyInfo* keyInfo = sig->getKeyInfo();
+ if (keyInfo)
+ return resolveKey(keyInfo);
+ DSIGSignature* native = sig->getXMLSignature();
+ if (native) {
+ DSIGKeyInfoList* nativeK = native->getKeyInfoList();
+ if (nativeK)
+ return resolveKey(nativeK);
+ }
+ return NULL;
+}
+
vector<XSECCryptoX509*>::size_type KeyResolver::resolveCertificates(
const KeyInfo* keyInfo, ResolvedCertificates& certs
) const
return 0;
}
+vector<XSECCryptoX509*>::size_type KeyResolver::resolveCertificates(
+ const Signature* sig, ResolvedCertificates& certs
+ ) const
+{
+ const KeyInfo* keyInfo = sig->getKeyInfo();
+ if (keyInfo)
+ return resolveCertificates(keyInfo, certs);
+ DSIGSignature* native = sig->getXMLSignature();
+ if (native) {
+ DSIGKeyInfoList* nativeK = native->getKeyInfoList();
+ if (nativeK)
+ return resolveCertificates(nativeK, certs);
+ }
+ return NULL;
+}
+
XSECCryptoX509CRL* KeyResolver::resolveCRL(const KeyInfo* keyInfo) const
{
return NULL;
{
return NULL;
}
+
+XSECCryptoX509CRL* KeyResolver::resolveCRL(const Signature* sig) const
+{
+ const KeyInfo* keyInfo = sig->getKeyInfo();
+ if (keyInfo)
+ return resolveCRL(keyInfo);
+ DSIGSignature* native = sig->getXMLSignature();
+ if (native) {
+ DSIGKeyInfoList* nativeK = native->getKeyInfoList();
+ if (nativeK)
+ return resolveCRL(nativeK);
+ }
+ return NULL;
+}