* Structure to collect encryption requirements.
*/
struct XMLTOOL_API EncryptionParams {
-
/**
* Constructor.
*
}
~EncryptionParams() {}
- private:
+
+ /** Data encryption algorithm. */
const XMLCh* m_algorithm;
+
+ /** Buffer containing encryption key. */
const unsigned char* m_keyBuffer;
+
+ /** Size of buffer. */
unsigned int m_keyBufferSize;
+
+ /** Credential containing the encryption key. */
const xmltooling::Credential* m_credential;
+
+ /** Flag limiting the size of the encrypted XML representation. */
bool m_compact;
-
- friend class Encrypter;
};
/**
* Structure to collect key wrapping/transport requirements.
*/
struct XMLTOOL_API KeyEncryptionParams {
-
/**
* Constructor.
*
}
~KeyEncryptionParams() {}
- private:
+
+ /** Credential containing key encryption key. */
const xmltooling::Credential& m_credential;
+
+ /** Key transport or wrapping algorithm. */
const XMLCh* m_algorithm;
+
+ /** Name of recipient that owns the key encryption key. */
const XMLCh* m_recipient;
-
- friend class Encrypter;
};
Encrypter() : m_cipher(NULL) {}
/**
* Maps a data encryption algorithm to an appropriate key transport algorithm to use.
*
- * @param algorithm data encryption algorithm
+ * @param credential the key encryption key
+ * @param encryptionAlg data encryption algorithm
* @return a key transport algorithm
*/
- static const XMLCh* getKeyTransportAlgorithm(const XMLCh* algorithm) {
- if (xercesc::XMLString::equals(algorithm,DSIGConstants::s_unicodeStrURI3DES_CBC))
- return DSIGConstants::s_unicodeStrURIRSA_1_5;
- else
- return DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1;
- }
+ static const XMLCh* getKeyTransportAlgorithm(const xmltooling::Credential& credential, const XMLCh* encryptionAlg);
private:
void checkParams(EncryptionParams& encParams, KeyEncryptionParams* kencParams);