org.gcube.common.utils.encryption
Class XMLDocumentEncrypter

java.lang.Object
  extended by 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
 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 Elements
 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 Elements

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:
encryptElementNamestrue - if the element names have to be encrypted, false if only their content has to be


Copyright © 2013. All Rights Reserved.