fi.hut.tml.xsmiles.mlfc.encryption
Class EncryptionCreator

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.encryption.EncryptionCreator

public class EncryptionCreator
extends java.lang.Object

Utility class for creating encrypted data.

Author:
honkkis, nps

Constructor Summary
EncryptionCreator()
           
 
Method Summary
static org.w3c.dom.Document createEmptyDoc(boolean ns)
          Create an empty document.
static org.w3c.dom.Element decrypt(org.w3c.dom.Node node, java.net.URL url, EncryptionKey key)
          Decrypt a document.
static org.w3c.dom.Element encrypt(org.w3c.dom.Node node, java.net.URL url, EncryptionKey key)
          Encrypt a document.
static EncryptionKey getKey(EncryptionKey key)
          Get the default encryption key.
static java.security.KeyStore getKeyStore(EncryptionKey key)
          Get the key store for an encryption key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptionCreator

public EncryptionCreator()
Method Detail

getKey

public static EncryptionKey getKey(EncryptionKey key)
Get the default encryption key.

Parameters:
key - the current encryption key

createEmptyDoc

public static org.w3c.dom.Document createEmptyDoc(boolean ns)
                                           throws java.lang.Exception
Create an empty document.

Parameters:
ns - should the document be namespace aware?
Throws:
java.lang.Exception - there was error creating the document

encrypt

public static org.w3c.dom.Element encrypt(org.w3c.dom.Node node,
                                          java.net.URL url,
                                          EncryptionKey key)
                                   throws java.lang.Exception
Encrypt a document.

Parameters:
node - the node to be encrypted
url - the base URL of doc
key - the encryption key
Returns:
the encrypted element, or null if the key could not be retrieved
Throws:
java.lang.Exception - the node could not be encrypted

decrypt

public static org.w3c.dom.Element decrypt(org.w3c.dom.Node node,
                                          java.net.URL url,
                                          EncryptionKey key)
                                   throws java.lang.Exception
Decrypt a document.

Parameters:
node - the node to be decrypted
url - the base URL of doc
key - the encryption key
Returns:
the decrypted element, or null if the key could not be retrieved
Throws:
java.lang.Exception - the node could not be encrypted

getKeyStore

public static java.security.KeyStore getKeyStore(EncryptionKey key)
                                          throws java.lang.Exception
Get the key store for an encryption key.

Parameters:
key - the key
Returns:
the keystore for the given key
Throws:
java.lang.Exception - the key sotre could not be accessed


X-Smiles 1.2