com.h3c.util.security

## Class EncryptedString

- java.lang.Object
- - com.h3c.util.security.EncryptedString

-     public class EncryptedString
      extends Object

  A utility to help with encrypting and decrypting string values.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EncryptedString(String password)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `decrypt(String str)` Decrypt a given string.
    `String` | `encrypt(String str)` Encrypt a given string.
    `boolean` | `isEncrypted(String str)` Check if a string is encrypted or not.

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

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

- - ### Field Detail

    - #### EMPTY

          public static final String EMPTY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### EncryptedString

          public EncryptedString(String password)
                          throws EncryptionException

      Constructor.
      Parameters:
        `password` - password used for encryption and decryption
      Throws:
        `EncryptionException` - crypto initialization exception

  - ### Method Detail

    - #### isEncrypted

          public boolean isEncrypted(String str)

      Check if a string is encrypted or not.
      Parameters:
        `str` - string to check
      Returns:
        true if encrypted, false otherwise

    - #### decrypt

          public String decrypt(String str)
                         throws EncryptionException

      Decrypt a given string. The string to be decrypted is assumed to have passed the `isEncrypted(String)` check with a

          true

      return value.
      Parameters:
        `str` - string to decrypt
      Returns:
        decrypted string
      Throws:
        `EncryptionException` - decryption error

    - #### encrypt

          public String encrypt(String str)
                         throws EncryptionException

      Encrypt a given string.
      Parameters:
        `str` - string to be encrypted
      Returns:
        encrypted string
      Throws:
        `EncryptionException` - encryption error

Copyright © 2014. All Rights Reserved.