org.eclipse.emf.ecore.resource.impl
Class CryptoCipherImpl

java.lang.Object
  extended byorg.eclipse.emf.ecore.resource.impl.CryptoCipherImpl
All Implemented Interfaces:
URIConverter.Cipher

public class CryptoCipherImpl
extends Object
implements URIConverter.Cipher

EMF default implementation for the URIConverter.Cipher interface. This is an example of how this class can be used:

Map options = new HashMap();
    options.put(Resource.OPTION_CIPHER, 
                new CryptoCipherImpl("a very long key indeed"));
    resource.save(options);
    resource.load(options);


Nested Class Summary
static class CryptoCipherImpl.LocalCipherOutputStream
           
 
Field Summary
protected static String ENCRYPTION_SCHEME
           
protected  String key
           
protected static String UNICODE_FORMAT
           
 
Constructor Summary
CryptoCipherImpl()
           
CryptoCipherImpl(String key)
           
 
Method Summary
 InputStream decrypt(InputStream inputStream)
          Decrypts the specified input stream.
 OutputStream encrypt(OutputStream outputStream)
          Encrypts the specified output stream.
 void finish(InputStream inputStream)
          This method is invoked after the decrypted input stream is used allowing the Cipher implementation to do any maintenance work required, such as flushing internal cache.
 void finish(OutputStream outputStream)
          This method is invoked after the encrypted output stream is used allowing the Cipher implementation to do any maintenance work required, such as flushing an internal cache.
protected  SecretKey getKey()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCRYPTION_SCHEME

protected static final String ENCRYPTION_SCHEME
See Also:
Constant Field Values

UNICODE_FORMAT

protected static final String UNICODE_FORMAT
See Also:
Constant Field Values

key

protected String key
Constructor Detail

CryptoCipherImpl

public CryptoCipherImpl()

CryptoCipherImpl

public CryptoCipherImpl(String key)
Method Detail

encrypt

public OutputStream encrypt(OutputStream outputStream)
                     throws Exception
Description copied from interface: URIConverter.Cipher
Encrypts the specified output stream.

Specified by:
encrypt in interface URIConverter.Cipher
Parameters:
outputStream -
Returns:
an encrypted output stream
Throws:
Exception

finish

public void finish(OutputStream outputStream)
            throws Exception
Description copied from interface: URIConverter.Cipher
This method is invoked after the encrypted output stream is used allowing the Cipher implementation to do any maintenance work required, such as flushing an internal cache.

Specified by:
finish in interface URIConverter.Cipher
Throws:
Exception

decrypt

public InputStream decrypt(InputStream inputStream)
                    throws Exception
Description copied from interface: URIConverter.Cipher
Decrypts the specified input stream.

Specified by:
decrypt in interface URIConverter.Cipher
Parameters:
inputStream -
Returns:
a decrypted input stream
Throws:
Exception

finish

public void finish(InputStream inputStream)
            throws Exception
Description copied from interface: URIConverter.Cipher
This method is invoked after the decrypted input stream is used allowing the Cipher implementation to do any maintenance work required, such as flushing internal cache.

Specified by:
finish in interface URIConverter.Cipher
Throws:
Exception

getKey

protected SecretKey getKey()
                    throws Exception
Throws:
Exception

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.