Merge "Remove the memory leak on osp-security-service" into tizen_2.2
[platform/framework/native/appfw.git] / inc / FSecCryptoRc2Cipher.h
index 123b5b0..309058c 100644 (file)
@@ -37,14 +37,14 @@ class _SymmetricCipher;
  *
  *     @since          2.0
  *
- *     The %Rc2Cipher class provides a symmetric cipher using the RC2 algorithm.
- *     It sets appropriate values for the requested mode/key bit/padding scheme and cipher operation (CIPHER_ENCRYPT or CIPHER_DECRYPT) parameters. @n
+ *     The %Rc2Cipher class provides a symmetric cipher using the RC2 algorithm. @n
+ *     This class allows to set appropriate values for the requested mode/key bit/padding scheme and cipher operation (CIPHER_ENCRYPT or CIPHER_DECRYPT) parameters. @n
  *
  *     For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/ciphers.htm">Ciphers</a>.
  *
  *     @see    ISymmetricCipher
- *  @see       DesCipher
- *  @see       DesEdeCipher
+ *     @see    DesCipher
+ *     @see    DesEdeCipher
  */
 class _OSP_EXPORT_ Rc2Cipher
        : public virtual ISymmetricCipher
@@ -73,7 +73,7 @@ public:
         *      @since          2.0
         *
         *      @return         An error code
-        *      @param[in]      transformation                  The name of the requested mode/padding scheme @n
+        *      @param[in]      transformation                  The requested mode/padding scheme @n
         *                                                                              The RC2 support variable length key ranges from 8 bits to 128 bits, in steps of 8 bits.
         *                                                                              The key bits are not required to be mentioned in the transformation.
         *                                                                              There are four valid transformations for RC2, "CBC/NOPADDING",
@@ -81,16 +81,19 @@ public:
         *      @param[in]      opMode                                  The cipher operation mode @n
         *                                                                              The valid values for %Rc2Cipher are @c CIPHER_ENCRYPT and @c CIPHER_DECRYPT.
         *      @exception      E_SUCCESS                               The method is successful.
-        *  @exception  E_OUT_OF_MEMORY                 The memory is insufficient.
-        *      @exception      E_INVALID_ARG                   A specified input parameter is invalid, or the specified @c opMode does not contain a valid value for the cipher operation.
-        *      @remarks        If @c opMode is not matching the actual operation, the result of the operation is @c null and an exception is returned. @n
-        *      For example, if @c opMode is set to @c CIPHER_ENCRYPT, @c CIPHER_WRAP, or @c CIPHER_UNWRAP and the DecryptN() method is used, then the result obtained is @c null and an exception is returned.
+        *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
+        *      @exception      E_INVALID_ARG                   Either of the following conditions has occurred:
+        *                                                                              - A specified input parameter is invalid.
+        *                                                                              - The specified @c opMode does not contain a valid value for the cipher operation.
+        *      @remarks                If @c opMode is not matching the actual operation, the result of the operation is @c null and an exception is returned. @n
+        *                              For example, if @c opMode is set to @c CIPHER_ENCRYPT, @c CIPHER_WRAP, or @c CIPHER_UNWRAP and the DecryptN() method is used, then the 
+        *                              result obtained is @c null and an exception is returned.
         */
        virtual result Construct(const Tizen::Base::String& transformation, enum CipherOperation opMode);
 
        /**
-        *      Sets a symmetric key for encryption or decryption. @n
-        *  The variable length key ranges from 8 bits to 128 bits, in steps of 8 bits.
+        *      Sets the symmetric key for encryption or decryption. @n
+        *      The variable length key ranges from 8 bits to 128 bits, in steps of 8 bits.
         *
         *      @since          2.0
         *
@@ -119,21 +122,21 @@ public:
         *      Encrypts the data (single-part).
         *
         *      @since          2.0
-        *
+        *      @pre            Before calling this method, set a secret key and an initial vector using SetKey() and SetInitialVector().
         *      @return         A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
         *                              else @c null if an error occurs
         *      @param[in]      input                                   An instance of Tizen::Base::ByteBuffer
         *      @exception      E_SUCCESS                               The method is successful.
-        *      @exception      E_INVALID_ARG                   The specified instance of Tizen::Base::ByteBuffer is invalid or empty.
+        *      @exception      E_INVALID_ARG                   The specified Tizen::Base::ByteBuffer instance is invalid or empty.
         *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
         *      @exception      E_KEY_NOT_FOUND                 The specified key is not found.
         *      @exception      E_INVALID_OPERATION             The specified cipher operation mode for this method is invalid.
         *      @exception      E_OVERFLOW                              This operation has caused the memory to overflow.
-        *      @exception      E_SYSTEM                                A system error has occurred. @n
-        *                                                                              The method has failed to operate with the OpenSSL library, or
-        *                                                                              the Tizen::Base::ByteBuffer operation has failed.
+        *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
+        *                                                                              - A system error has occurred.
+        *                                                                              - The method has failed to operate with the OpenSSL library.
+        *                                                                              - The Tizen::Base::ByteBuffer operation has failed.
         *      @remarks        The specific error code can be accessed using the GetLastResult() method.
-        *      @remarks        A secret key and an initial vector are set before calling this method.
         */
        virtual Tizen::Base::ByteBuffer* EncryptN(const Tizen::Base::ByteBuffer& input);
 
@@ -141,42 +144,42 @@ public:
         *      Decrypts the data (single-part).
         *
         *      @since          2.0
-        *
+        *      @pre            Before calling this method, set a secret key and an initial vector using SetKey() and SetInitialVector().
         *      @return         A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
         *                              else @c null if an error occurs
         *      @param[in]      input                                   An instance of Tizen::Base::ByteBuffer
         *      @exception      E_SUCCESS                               The method is successful.
-        *      @exception      E_INVALID_ARG                   The specified instance of Tizen::Base::ByteBuffer is invalid or empty.
+        *      @exception      E_INVALID_ARG                   The specified Tizen::Base::ByteBuffer instance is invalid or empty.
         *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
         *      @exception      E_KEY_NOT_FOUND                 The specified key is not found.
         *      @exception      E_INVALID_OPERATION             The specified cipher operation mode for this method is invalid.
         *      @exception      E_OVERFLOW                              This operation has caused the memory to overflow.
-        *      @exception      E_SYSTEM                                A system error has occurred. @n
-        *                                                                              The method has failed to operate with the OpenSSL library, or
-        *                                                                              the Tizen::Base::ByteBuffer operation has failed.
+        *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
+        *                                                                              - A system error has occurred.
+        *                                                                              - The method has failed to operate with the OpenSSL library.
+        *                                                                              - The Tizen::Base::ByteBuffer operation has failed.
         *      @remarks        The specific error code can be accessed using the GetLastResult() method.
-        *      @remarks        A secret key and an initial vector are set before calling this method.
         */
        virtual Tizen::Base::ByteBuffer* DecryptN(const Tizen::Base::ByteBuffer& input);
 
        /**
-        *      Initializes a multiple-part encryption or decryption operation.
+        *      Initializes the instance of %Rc2Cipher for the multiple-part encryption or decryption.
         *
         *      @since          2.0
-        *
+        *      @pre            Before calling this method, set a secret key and an initial vector using SetKey() and SetInitialVector().
         *      @return         An error code
         *      @exception      E_SUCCESS                               The method is successful.
         *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
         *      @exception      E_KEY_NOT_FOUND                 The specified key is not found.
         *      @exception      E_INVALID_OPERATION             The specified cipher operation mode for this method is invalid.
-        *      @exception      E_SYSTEM                                A system error has occurred. @n
-        *                                                                              The method has failed to operate with the OpenSSL library.
-        *      @remarks        A secret key and an initial vector are set before calling this method.
+        *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
+        *                                                                              - A system error has occurred.
+        *                                                                              - The method has failed to operate with the OpenSSL library.
         */
        virtual result Initialize(void);
 
        /**
-        *      Updates a multiple-part encryption or decryption operation.
+        *      Updates the multiple-part encryption or decryption operation.
         *
         *      @since          2.0
         *
@@ -186,16 +189,17 @@ public:
         *      @exception      E_SUCCESS                               The method is successful.
         *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
         *      @exception      E_OVERFLOW                              This operation has caused the memory to overflow.
-        *      @exception      E_INVALID_ARG                   The specified instance of Tizen::Base::ByteBuffer is invalid or empty.
-        *      @exception      E_SYSTEM                                A system error has occurred. @n
-        *                                                                              The method has failed to operate with the OpenSSL library, or
-        *                                                                              the Tizen::Base::ByteBuffer operation has failed.
+        *      @exception      E_INVALID_ARG                   The specified Tizen::Base::ByteBuffer instance is invalid or empty.
+        *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
+        *                                                                              - A system error has occurred.
+        *                                                                              - The method has failed to operate with the OpenSSL library.
+        *                                                                              - The Tizen::Base::ByteBuffer operation has failed.
         *      @remarks        The specific error code can be accessed using the GetLastResult() method.
         */
        virtual Tizen::Base::ByteBuffer* UpdateN(const Tizen::Base::ByteBuffer& input);
 
        /**
-        *      Finalizes a multiple-part encryption or decryption operation.
+        *      Finalizes the multiple-part encryption or decryption operation.
         *
         *      @since          2.0
         *
@@ -204,9 +208,10 @@ public:
         *      @exception      E_SUCCESS                               The method is successful.
         *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
         *      @exception      E_OVERFLOW                              This operation has caused the memory to overflow.
-        *      @exception      E_SYSTEM                                A system error has occurred. @n
-        *                                                                              The method has failed to operate with the OpenSSL library, or
-        *                                                                              the Tizen::Base::ByteBuffer operation has failed.
+        *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
+        *                                                                              - A system error has occurred.
+        *                                                                              - The method has failed to operate with the OpenSSL library.
+        *                                                                              - The Tizen::Base::ByteBuffer operation has failed.
         *      @remarks        The specific error code can be accessed using the GetLastResult() method.
         */
        virtual Tizen::Base::ByteBuffer* FinalizeN(void);
@@ -219,9 +224,10 @@ public:
         *      @return         A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
         *                              else @c null if an error occurs
         *      @param[in]      secretKey                               The secret key to wrap
-        *      @remarks        This operation is not supported in the %Rc2Cipher class.
-        *                              Therefore, this method always returns @c null.
-        *      @remarks        The @c E_UNSUPPORTED_ALGORITHM exception is returned using the GetLastResult() method.
+        *      @remarks        
+        *                      - This operation is not supported in the %Rc2Cipher class.
+        *                      Therefore, this method always returns @c null.
+        *                      - The @c E_UNSUPPORTED_ALGORITHM exception is returned using the GetLastResult() method.
         */
        virtual Tizen::Base::ByteBuffer* WrapN(const Tizen::Base::ByteBuffer& secretKey);
 
@@ -233,9 +239,10 @@ public:
         *      @return         A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
         *                              else @c null if an error occurs
         *      @param[in]      wrappedKey                              The wrapped key to unwrap
-        *      @remarks        This operation is not supported in the %Rc2Cipher class.
-        *                              Therefore, this method always returns @c null.
-        *      @remarks        The @c E_UNSUPPORTED_ALGORITHM exception is returned using the GetLastResult() method.
+        *      @remarks        
+        *                      - This operation is not supported in the %Rc2Cipher class.
+        *                      Therefore, this method always returns @c null.
+        *                      - The @c E_UNSUPPORTED_ALGORITHM exception is returned using the GetLastResult() method.
         */
        virtual Tizen::Base::ByteBuffer* UnwrapN(const Tizen::Base::ByteBuffer& wrappedKey);