Package com.emc.documentum.rest.common.crypto

# Interface Crypto

All Known Subinterfaces:
  `Crypto`

public interface Crypto
An interface to encrypt or decrypt binaries.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `decrypt(byte[] encryptedBytes)`
  Decrypt the byte array encrypted from corresponding encrypt() method of this crypto.
  `byte[]`
  `encrypt(byte[] plainBytes)`
  Encrypt the input bytes, a server ID will be concatenate on the encrypted byte array.
  `byte[]`
  `generateRandomBytes(int length)`
  Generate the random byte array according given bit length.

- ## Method Details

  - ### encrypt

    byte[] encrypt(byte[] plainBytes) throws com.emc.documentum.rest.common.crypto.CryptoException
    Encrypt the input bytes, a server ID will be concatenate on the encrypted byte array. The final byte array is BASE64 encoded.
    Parameters:
      `plainBytes` - byte array to encrypt
    Returns:
      the encrypted byte array in BASE64.
    Throws:
      `com.emc.documentum.rest.common.crypto.CryptoException` - the exception during the operation

  - ### decrypt

    byte[] decrypt(byte[] encryptedBytes) throws com.emc.documentum.rest.common.crypto.CryptoException
    Decrypt the byte array encrypted from corresponding encrypt() method of this crypto.
    Parameters:
      `encryptedBytes` - byte arrary to decrypt, it must come from the encrypt() of the same crypto.
    Returns:
      the decrypted byte arrary.
    Throws:
      `com.emc.documentum.rest.common.crypto.CryptoException` - the exception during the operation

  - ### generateRandomBytes

    byte[] generateRandomBytes(int length) throws com.emc.documentum.rest.common.crypto.CryptoException
    Generate the random byte array according given bit length.
    Parameters:
      `length` - bit length.
    Returns:
      the byte arrary.
    Throws:
      `com.emc.documentum.rest.common.crypto.CryptoException` - the exception during the operation