X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fencryption%2FEncrypter.h;h=e1723e9b63fb214574e59d1b8ef6484f3c6f6299;hb=420effca96f38dfa5f2a6549679a5d455a3945a7;hp=e01803ac088472af7dfdfc5dbb8c71f330225750;hpb=2b5c784e2d92df67fcb27e2711833bc40795d821;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/encryption/Encrypter.h b/xmltooling/encryption/Encrypter.h index e01803a..e1723e9 100644 --- a/xmltooling/encryption/Encrypter.h +++ b/xmltooling/encryption/Encrypter.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,11 @@ #if !defined(__xmltooling_encrypter_h__) && !defined(XMLTOOLING_NO_XMLSEC) #define __xmltooling_encrypter_h__ -#include +#include -#include -#include +#include + +class XENCCipher; namespace xmltooling { class XMLTOOL_API Credential; @@ -34,6 +35,9 @@ namespace xmltooling { namespace xmlencryption { + class XMLTOOL_API EncryptedData; + class XMLTOOL_API EncryptedKey; + /** * Wrapper API for XML Encryption functionality. * Designed to allow both external and internal key generation as follows: @@ -77,16 +81,18 @@ namespace xmlencryption { * @param compact true iff the encrypted representation should be made as small as possible */ EncryptionParams( +#ifdef XSEC_OPENSSL_HAVE_AES const XMLCh* algorithm=DSIGConstants::s_unicodeStrURIAES128_CBC, - const unsigned char* keyBuffer=NULL, +#else + const XMLCh* algorithm=DSIGConstants::s_unicodeStrURI3DES_CBC, +#endif + const unsigned char* keyBuffer=nullptr, unsigned int keyBufferSize=0, - const xmltooling::Credential* credential=NULL, + const xmltooling::Credential* credential=nullptr, bool compact=false - ) : m_algorithm(algorithm), m_keyBuffer(keyBuffer), m_keyBufferSize(keyBufferSize), - m_credential(credential), m_compact(compact) { - } + ); - ~EncryptionParams() {} + ~EncryptionParams(); /** Data encryption algorithm. */ const XMLCh* m_algorithm; @@ -116,13 +122,10 @@ namespace xmlencryption { * @param recipient optional name of recipient of encrypted key */ KeyEncryptionParams( - const xmltooling::Credential& credential, - const XMLCh* algorithm=NULL, - const XMLCh* recipient=NULL - ) : m_credential(credential), m_algorithm(algorithm), m_recipient(recipient) { - } + const xmltooling::Credential& credential, const XMLCh* algorithm=nullptr, const XMLCh* recipient=nullptr + ); - ~KeyEncryptionParams() {} + ~KeyEncryptionParams(); /** Credential containing key encryption key. */ const xmltooling::Credential& m_credential; @@ -134,9 +137,9 @@ namespace xmlencryption { const XMLCh* m_recipient; }; - Encrypter() : m_cipher(NULL) {} + Encrypter(); - ~Encrypter(); + virtual ~Encrypter(); /** * Encrypts the supplied element and returns the resulting object. @@ -150,11 +153,11 @@ namespace xmlencryption { * * @param element the DOM element to encrypt * @param encParams primary encryption settings - * @param kencParams key encryption settings, or NULL + * @param kencParams key encryption settings, or nullptr * @return a stand-alone EncryptedData object, unconnected to the source DOM */ EncryptedData* encryptElement( - xercesc::DOMElement* element, EncryptionParams& encParams, KeyEncryptionParams* kencParams=NULL + xercesc::DOMElement* element, EncryptionParams& encParams, KeyEncryptionParams* kencParams=nullptr ); /** @@ -169,11 +172,11 @@ namespace xmlencryption { * * @param element parent element of children to encrypt * @param encParams primary encryption settings - * @param kencParams key encryption settings, or NULL + * @param kencParams key encryption settings, or nullptr * @return a stand-alone EncryptedData object, unconnected to the source DOM */ EncryptedData* encryptElementContent( - xercesc::DOMElement* element, EncryptionParams& encParams, KeyEncryptionParams* kencParams=NULL + xercesc::DOMElement* element, EncryptionParams& encParams, KeyEncryptionParams* kencParams=nullptr ); /** @@ -188,10 +191,10 @@ namespace xmlencryption { * * @param input the stream to encrypt * @param encParams primary encryption settings - * @param kencParams key encryption settings, or NULL + * @param kencParams key encryption settings, or nullptr * @return a stand-alone EncryptedData object, unconnected to any DOM */ - EncryptedData* encryptStream(std::istream& input, EncryptionParams& encParams, KeyEncryptionParams* kencParams=NULL); + EncryptedData* encryptStream(std::istream& input, EncryptionParams& encParams, KeyEncryptionParams* kencParams=nullptr); /** * Encrypts the supplied key and returns the resulting object.