play.libs

## Class Crypto

- java.lang.Object
- - play.libs.Crypto

-     public class Crypto
      extends java.lang.Object

  Cryptography utils

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Crypto.HashType` Define a hash type enumeration for strong-typing

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Crypto()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `decryptAES(java.lang.String value)` Decrypt a String with the AES encryption standard using the application secret
    `static java.lang.String` | `decryptAES(java.lang.String value, java.lang.String privateKey)` Decrypt a String with the AES encryption standard.
    `static java.lang.String` | `encryptAES(java.lang.String value)` Encrypt a String with the AES encryption standard using the application secret
    `static java.lang.String` | `encryptAES(java.lang.String value, java.lang.String privateKey)` Encrypt a String with the AES encryption standard.
    `static java.lang.String` | `passwordHash(java.lang.String input)` Create a password hash using the default hashing algorithm
    `static java.lang.String` | `passwordHash(java.lang.String input, Crypto.HashType hashType)` Create a password hash using specific hashing algorithm
    `static java.lang.String` | `sign(java.lang.String message)` Sign a message using the application secret key (HMAC-SHA1)
    `static java.lang.String` | `sign(java.lang.String message, byte[] key)` Sign a message with a key

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

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

- - ### Constructor Detail

    - #### Crypto

          public Crypto()

  - ### Method Detail

    - #### sign

          public static java.lang.String sign(java.lang.String message)

      Sign a message using the application secret key (HMAC-SHA1)
      Parameters:
        `message` - the message to sign
      Returns:
        The signed message

    - #### sign

          public static java.lang.String sign(java.lang.String message,
                                              byte[] key)

      Sign a message with a key
      Parameters:
        `message` - The message to sign
        `key` - The key to use
      Returns:
        The signed message (in hexadecimal)

    - #### passwordHash

          public static java.lang.String passwordHash(java.lang.String input)

      Create a password hash using the default hashing algorithm
      Parameters:
        `input` - The password
      Returns:
        The password hash

    - #### passwordHash

          public static java.lang.String passwordHash(java.lang.String input,
                                                      Crypto.HashType hashType)

      Create a password hash using specific hashing algorithm
      Parameters:
        `input` - The password
        `hashType` - The hashing algorithm
      Returns:
        The password hash

    - #### encryptAES

          public static java.lang.String encryptAES(java.lang.String value)

      Encrypt a String with the AES encryption standard using the application secret
      Parameters:
        `value` - The String to encrypt
      Returns:
        An hexadecimal encrypted string

    - #### encryptAES

          public static java.lang.String encryptAES(java.lang.String value,
                                                    java.lang.String privateKey)

      Encrypt a String with the AES encryption standard. Private key must have a length of 16 bytes
      Parameters:
        `value` - The String to encrypt
        `privateKey` - The key used to encrypt
      Returns:
        An hexadecimal encrypted string

    - #### decryptAES

          public static java.lang.String decryptAES(java.lang.String value)

      Decrypt a String with the AES encryption standard using the application secret
      Parameters:
        `value` - An hexadecimal encrypted string
      Returns:
        The decrypted String

    - #### decryptAES

          public static java.lang.String decryptAES(java.lang.String value,
                                                    java.lang.String privateKey)

      Decrypt a String with the AES encryption standard. Private key must have a length of 16 bytes
      Parameters:
        `value` - An hexadecimal encrypted string
        `privateKey` - The key used to encrypt
      Returns:
        The decrypted String

Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly