HDIV API 2.0.4

org.hdiv.cipher
Class MockCipherHTTP

java.lang.Object
  extended by org.hdiv.cipher.MockCipherHTTP
All Implemented Interfaces:
java.io.Serializable, ICipherHTTP

public class MockCipherHTTP
extends java.lang.Object
implements ICipherHTTP

Mock implementation of ICipherHTTP only to tests.

Author:
Roberto Velasco
See Also:
Serialized Form

Constructor Summary
MockCipherHTTP()
           
 
Method Summary
 byte[] decrypt(byte[] data)
          Decrypts data in a single-part operation, or finishes a multiple-part operation.
 java.lang.String decrypt(java.lang.String data)
           
 byte[] encrypt(byte[] data)
          Encrypts data in a single-part operation, or finishes a multiple-part operation.
 java.lang.String encrypt(java.lang.String data)
           
 java.lang.String getAlgorithm()
           
 void initDecryptMode(Key key)
          Generates a Cipher object that implements the specified transformation, initializes cipher vector and initializes cipher to decryption mode with a key and a set of algorithm parameters.
 void initEncryptMode(Key key)
          Generates a Cipher object that implements the specified transformation, initializes cipher vector and initializes cipher to encryption mode with a key and a set of algorithm parameters.
 void setAlgorithm(java.lang.String algorithm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockCipherHTTP

public MockCipherHTTP()
Method Detail

decrypt

public java.lang.String decrypt(java.lang.String data)

encrypt

public java.lang.String encrypt(java.lang.String data)

decrypt

public byte[] decrypt(byte[] data)
Description copied from interface: ICipherHTTP
Decrypts data in a single-part operation, or finishes a multiple-part operation. The data is decrypted depending on how this cipher was initialized.

The bytes in the input buffer, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. The result is stored in a new buffer.

if any exception is thrown, this cipher object may need to be reset before it can be used again.

Specified by:
decrypt in interface ICipherHTTP
Parameters:
data - The input buffer to decrypt
Returns:
The new buffer with the result

encrypt

public byte[] encrypt(byte[] data)
Description copied from interface: ICipherHTTP
Encrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted depending on how this cipher was initialized.

The bytes in the input buffer, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. The result is stored in a new buffer.

if any exception is thrown, this cipher object may need to be reset before it can be used again.

Specified by:
encrypt in interface ICipherHTTP
Parameters:
data - The input buffer to encrypt
Returns:
The new buffer with the result

initEncryptMode

public void initEncryptMode(Key key)
Description copied from interface: ICipherHTTP
Generates a Cipher object that implements the specified transformation, initializes cipher vector and initializes cipher to encryption mode with a key and a set of algorithm parameters.

Specified by:
initEncryptMode in interface ICipherHTTP
Parameters:
key - the encryption key

initDecryptMode

public void initDecryptMode(Key key)
Description copied from interface: ICipherHTTP
Generates a Cipher object that implements the specified transformation, initializes cipher vector and initializes cipher to decryption mode with a key and a set of algorithm parameters.

Specified by:
initDecryptMode in interface ICipherHTTP
Parameters:
key - the encryption key

getAlgorithm

public java.lang.String getAlgorithm()

setAlgorithm

public void setAlgorithm(java.lang.String algorithm)

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.