X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fencryption%2FEncryptedKeyResolver.cpp;h=e6e002830b901093e817127a35a0d49f3eb0ad9e;hb=d8a4f024b89272eae00618fc39e6127b6c191edd;hp=6a8f81b650271e73bae73456a9cd4cb82ff0d82e;hpb=c77019168bb64c2a5271f55e76addc508e94948f;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/encryption/EncryptedKeyResolver.cpp b/saml/encryption/EncryptedKeyResolver.cpp index 6a8f81b..e6e0028 100644 --- a/saml/encryption/EncryptedKeyResolver.cpp +++ b/saml/encryption/EncryptedKeyResolver.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -17,20 +17,34 @@ /** * EncryptedKeyResolver.cpp * - * SAML-specific encrypted key resolver + * SAML-specific encrypted key resolver. */ #include "internal.h" #include "encryption/EncryptedKeyResolver.h" +#include "saml2/core/Assertions.h" using namespace xmlencryption; +using opensaml::saml2::EncryptedElementType; using namespace std; -EncryptedKey* opensaml::EncryptedKeyResolver::resolveKey(EncryptedData& encryptedData) const +opensaml::EncryptedKeyResolver::EncryptedKeyResolver(const EncryptedElementType& ref) : m_ref(ref) { +} + +opensaml::EncryptedKeyResolver::~EncryptedKeyResolver() +{ +} + +const EncryptedKey* opensaml::EncryptedKeyResolver::resolveKey(const EncryptedData& encryptedData, const XMLCh* recipient) const +{ + const EncryptedKey* base = xmlencryption::EncryptedKeyResolver::resolveKey(encryptedData, recipient); + if (base) + return base; + const vector& keys=m_ref.getEncryptedKeys(); for (vector::const_iterator i=keys.begin(); i!=keys.end(); i++) { - if (XMLString::equals(m_recipient,(*i)->getRecipient())) + if (XMLString::equals(recipient,(*i)->getRecipient())) return (*i); } return NULL;