X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fencryption%2FEncryptedKeyResolver.h;fp=saml%2Fencryption%2FEncryptedKeyResolver.h;h=cc6d2a28e3b1848f9452caf25befe0b1092f7c98;hb=034395d99c818fb5489421fd4e7aa4eb3fa5d173;hp=0000000000000000000000000000000000000000;hpb=c88350c124d867ae1126c495acde8246065d3df9;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/encryption/EncryptedKeyResolver.h b/saml/encryption/EncryptedKeyResolver.h new file mode 100644 index 0000000..cc6d2a2 --- /dev/null +++ b/saml/encryption/EncryptedKeyResolver.h @@ -0,0 +1,62 @@ +/* + * Copyright 2001-2006 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file EncryptedKeyResolver.h + * + * SAML-specific encrypted key resolver + */ + +#ifndef __saml_enckeyres_h__ +#define __saml_enckeyres_h__ + +#include +#include +#include + +namespace opensaml { + + /** + * SAML-specific encrypted key resolver. + * + * SAML allows placement of keys alongside the encrypted data. This resolver + * recognizes the implied placement. + */ + class SAML_API EncryptedKeyResolver : public xmlencryption::EncryptedKeyResolver + { + public: + EncryptedKeyResolver(const saml2::EncryptedElementType& ref, const XMLCh* recipient=NULL) + : m_ref(ref), m_recipient(XMLString::replicate(recipient)) { + } + + virtual ~EncryptedKeyResolver() { + XMLString::release(&m_recipient); + } + + xmlencryption::EncryptedKey* resolveKey(xmlencryption::EncryptedData* encryptedData); + + EncryptedKeyResolver* clone() const { + return new EncryptedKeyResolver(m_ref, m_recipient); + } + + protected: + const saml2::EncryptedElementType& m_ref; + XMLCh* m_recipient; + }; + +}; + +#endif /* __saml_enckeyres_h__ */