/** {@inheritDoc} */
  @Override
  public byte[] encrypt(final byte[] bytes) throws EncyptionException {
    try {
      final javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("AES/CBC/PKCS5Padding");
      cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, this.secretKey);

      final AlgorithmParameters params = cipher.getParameters();
      final byte[] ivBytes = params.getParameterSpec(IvParameterSpec.class).getIV();
      final byte[] dataBytes = cipher.doFinal(bytes);
      final byte[] secret = ArrayOfBytesType.TYPE.toBytes(ivBytes, dataBytes);
      return secret;
    } catch (final NoSuchAlgorithmException problem) {
      throw new EncyptionException(problem);
    } catch (final NoSuchPaddingException problem) {
      throw new EncyptionException(problem);
    } catch (final InvalidKeyException problem) {
      throw new EncyptionException(problem);
    } catch (final InvalidParameterSpecException problem) {
      throw new EncyptionException(problem);
    } catch (final IllegalBlockSizeException problem) {
      throw new EncyptionException(problem);
    } catch (final BadPaddingException problem) {
      throw new EncyptionException(problem);
    }
  }