Package org.apache.synapse.commons.crypto

## Class Util

- java.lang.Object
- - org.apache.synapse.commons.crypto.Util

-     public class Util
      extends Object

  This is a util class to provide required functions.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Util()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static byte[]` | `append​(byte[] value, byte[] toAppend)` | Helper method to append encrypted parts to the response.
    `static EncodeDecodeTypes` | `getEncodeDecodeType​(String value, EncodeDecodeTypes defaultValue)` | Helper method to decide encode decode types.
    `static boolean` | `validatePasswords​(String identityStorePass, String identityKeyPass)` | Helper method to validate store password and key password

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Util

          public Util()

  - ### Method Detail

    - #### validatePasswords

          public static boolean validatePasswords​(String identityStorePass,
                                                  String identityKeyPass)

      Helper method to validate store password and key password

      Note : this method will validate whether both the private key and the identity store password is present, if it's not present the validation will fail.

      Parameters:
        `identityStorePass` - password of the identity store
        `identityKeyPass` - identify store private key password
      Returns:
        if valid true, false otherwise

    - #### getEncodeDecodeType

          public static EncodeDecodeTypes getEncodeDecodeType​(String value,
                                                              EncodeDecodeTypes defaultValue)

      Helper method to decide encode decode types.
      Parameters:
        `value` -
        `defaultValue` -
      Returns:
        type

    - #### append

          public static byte[] append​(byte[] value,
                                      byte[] toAppend)

      Helper method to append encrypted parts to the response.
      Parameters:
        `value` -
        `toAppend` -
      Returns:
        response