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

java.lang.Object
  extended by org.eclipse.emf.ecore.resource.impl.DESCipherImpl
All Implemented Interfaces:
URIConverter.Cipher
Direct Known Subclasses:
CryptoCipherImpl

public class DESCipherImpl
extends java.lang.Object
implements URIConverter.Cipher

EMF implementation for the URIConverter.Cipher interface using the DES encryption algorithm.

This shows how this class can be used:

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

Since:
2.3.0

Field Summary
protected static java.lang.String ENCRYPTION_SCHEME
           
protected  javax.crypto.SecretKey key
           
protected  java.lang.String stringKey
           
protected static java.lang.String UNICODE_FORMAT
           
 
Constructor Summary
DESCipherImpl()
           
DESCipherImpl(java.lang.String key)
           
 
Method Summary
 java.io.InputStream decrypt(java.io.InputStream inputStream)
          Decrypts the specified input stream.
 java.io.OutputStream encrypt(java.io.OutputStream outputStream)
          Encrypts the specified output stream.
 void finish(java.io.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(java.io.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  javax.crypto.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 java.lang.String ENCRYPTION_SCHEME
See Also:
Constant Field Values

UNICODE_FORMAT

protected static final java.lang.String UNICODE_FORMAT
See Also:
Constant Field Values

stringKey

protected java.lang.String stringKey

key

protected javax.crypto.SecretKey key
Constructor Detail

DESCipherImpl

public DESCipherImpl()

DESCipherImpl

public DESCipherImpl(java.lang.String key)
Method Detail

encrypt

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

Specified by:
encrypt in interface URIConverter.Cipher
Returns:
an encrypted output stream
Throws:
java.lang.Exception

finish

public void finish(java.io.OutputStream outputStream)
            throws java.lang.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
Parameters:
outputStream - the encrypted stream returned by URIConverter.Cipher.encrypt(OutputStream).
Throws:
java.lang.Exception

decrypt

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

Specified by:
decrypt in interface URIConverter.Cipher
Returns:
a decrypted input stream
Throws:
java.lang.Exception

finish

public void finish(java.io.InputStream inputStream)
            throws java.lang.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
Parameters:
inputStream - the stream returned by URIConverter.Cipher.decrypt(InputStream).
Throws:
java.lang.Exception

getKey

protected javax.crypto.SecretKey getKey()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

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