XMLDocumentEncrypter (EncryptionLibrary 1.0.2-3.9.0 API)
Date: 2015-12-03

org.gcube.common.utils.encryption

## Class XMLDocumentEncrypter

- java.lang.Object
- - org.gcube.common.utils.encryption.XMLDocumentEncrypter

- All Implemented Interfaces:
    Encrypter<Element>

      public class XMLDocumentEncrypter
      extends Object
      implements Encrypter<Element>

  Encrypter for `Element` objects
  Author:
    Manuele Simi (CNR)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Element` | `decrypt(Element encryptedDataElement, Key... key)` Decrypts the element and all its descendants (if any)
    `Element` | `encrypt(Element element, Key... key)` Encrypts the element with the given key or the default key
    `static XMLDocumentEncrypter` | `getEncrypter()` Gets the Encrypter for `Element`s
    `void` | `setEncryptElementNames(boolean encryptElementNames)` Decides if the element names must be also encrypted or only their content

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

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

- - ### Method Detail

    - #### getEncrypter

          public static XMLDocumentEncrypter getEncrypter()

      Gets the Encrypter for `Element`s
      Returns:
        the encrypter

    - #### decrypt

          public Element decrypt(Element encryptedDataElement,
                        Key... key)
                          throws Exception

      Decrypts the element and all its descendants (if any)
      Specified by:
        `decrypt` in interface `Encrypter<Element>`
      Parameters:
        `encryptedDataElement` - the object to decrypt
        `key` - the key
      Returns:
        the decrypted object
      Throws:
        `Exception` - if the key is not available, invalid or the object cannot be decrypted

    - #### encrypt

          public Element encrypt(Element element,
                        Key... key)
                          throws Exception

      Encrypts the element with the given key or the default key
      Specified by:
        `encrypt` in interface `Encrypter<Element>`
      Parameters:
        `element` - the object to encrypt
        `key` - the key
      Returns:
        the encrypted object
      Throws:
        `Exception` - if the key is not available, invalid or the object cannot be encrypted

    - #### setEncryptElementNames

          public void setEncryptElementNames(boolean encryptElementNames)

      Decides if the element names must be also encrypted or only their content
      Parameters:
        `encryptElementNames`true`` - if the element names have to be encrypted, `false` if only their content has to be

Copyright © 2015. All Rights Reserved.