Merge branch '1.x' of ssh://authdev.it.ohio-state.edu/~scantor/git/cpp-xmltooling...
[shibboleth/cpp-xmltooling.git] / xmltooling / encryption / Encrypter.h
index a195585..1996b48 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  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.
- * You may obtain a copy of the License at
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
+ *
+ * UCAID licenses this file to you 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
+ * 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.
+ * 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.
  */
 
 /**
@@ -81,10 +85,14 @@ 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
                 );
 
@@ -118,7 +126,7 @@ namespace xmlencryption {
              * @param recipient     optional name of recipient of encrypted key
              */
             KeyEncryptionParams(
-                const xmltooling::Credential& credential, const XMLCh* algorithm=NULL, const XMLCh* recipient=NULL
+                const xmltooling::Credential& credential, const XMLCh* algorithm=nullptr, const XMLCh* recipient=nullptr
                 );
         
             ~KeyEncryptionParams();
@@ -149,11 +157,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
             );
 
         /**
@@ -168,11 +176,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
             );
 
         /**
@@ -187,10 +195,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.