Add some missing comments.
[shibboleth/cpp-xmltooling.git] / xmltooling / encryption / Encrypter.h
index c0f5463..1c85762 100644 (file)
@@ -64,7 +64,6 @@ namespace xmlencryption {
          * Structure to collect encryption requirements.
          */
         struct XMLTOOL_API EncryptionParams {
-            
             /**
              * Constructor.
              *
@@ -88,21 +87,27 @@ namespace xmlencryption {
             }
 
             ~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.
              * 
@@ -118,12 +123,15 @@ namespace xmlencryption {
             }
         
             ~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) {}
@@ -201,15 +209,11 @@ namespace xmlencryption {
         /**
          * 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);