Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-04


oracle.security.crypto.core
Class Coder

java.lang.Object
  extended by oracle.security.crypto.core.Coder

Direct Known Subclasses:
Cipher

public abstract class Coder
extends java.lang.Object

An abstract class that represents an encoding and decoding function, suitable for operations such as encryption and decryption, or compression and decompression.

A Coder object consists of two operations: An encoding operation, which transforms byte sequences into other byte sequences, and a corresponding decoding operation, which is the inverse of the encoding operation.

A Coder has a block size, which is the smallest length of a sequence which can be encoded or decoded. The length of any data which is input to the coder for encoding or decoding must be a multiple of the block size.

This is an abstract class. The following methods need to be implemented in a subclass:


Constructor Summary
protected Coder()
          Standard constructor.

 

Method Summary
abstract  java.lang.String algName()
          Returns the name of the algorithm which this coder implements.
 byte[] decode(byte[] bytes)
          Decodes an entire array of bytes.
 byte[] decode(byte[] bytes, int offset, int length)
          Decode an array of bytes, with the specified offset and number of bytes.
abstract  byte[] decodeOp(byte[] bytes)
          Decodes an array whose length is exactly equal to the block size.
 byte[] encode(byte[] bytes)
          Encode an entire array of bytes.
 byte[] encode(byte[] bytes, int offset, int length)
          Encode array of bytes, with the specified offset and number of bytes.
abstract  byte[] encodeOp(byte[] bytes)
          Encode an array which is exactly blockSize length.
abstract  int getBlockSize()
          Returns the block size of the coder.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Coder

protected Coder()
Standard constructor.

Method Detail

getBlockSize

public abstract int getBlockSize()
Returns the block size of the coder.

encode

public byte[] encode(byte[] bytes,
                     int offset,
                     int length)
              throws CoderException
Encode array of bytes, with the specified offset and number of bytes.
Parameters:
bytes - The bytes to be encoded.
offset - The index of the start of data.
length - The length of the data.
Returns:
The encoded bytes.
Throws:
CoderException - If coder not initialized, block size incorrect, etc.

encode

public byte[] encode(byte[] bytes)
              throws CoderException
Encode an entire array of bytes.
Parameters:
bytes - The bytes to be encoded.
Returns:
The encoded bytes.
Throws:
CoderException - If coder not initialized, block size incorrect, etc.

encodeOp

public abstract byte[] encodeOp(byte[] bytes)
                         throws CoderException
Encode an array which is exactly blockSize length. Must be implemented by subclass.
Returns:
The encoded bytes.
Throws:
CoderException - Thrown if blockSize is wrong.

decode

public byte[] decode(byte[] bytes,
                     int offset,
                     int length)
              throws CoderException
Decode an array of bytes, with the specified offset and number of bytes.
Parameters:
bytes - The bytes to be encoded.
offset - The index of the start of data.
length - The length of the data.
Returns:
The decoded bytes.
Throws:
CoderException - If coder not initialized, block size incorrect, etc.

decode

public byte[] decode(byte[] bytes)
              throws CoderException
Decodes an entire array of bytes.
Parameters:
bytes - The data to be decoded.
Returns:
The decoded bytes.
Throws:
CoderException - If coder not initialized, data is not a multiple of the block size, etc.

decodeOp

public abstract byte[] decodeOp(byte[] bytes)
                         throws CoderException
Decodes an array whose length is exactly equal to the block size. Must be implemented by subclasses.
Parameters:
bytes - The data to be decoded.
Returns:
The decoded bytes.
Throws:
CoderException - If blockSize is wrong.

algName

public abstract java.lang.String algName()
Returns the name of the algorithm which this coder implements.

Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-04


Copyright © 2005, 2011 , Oracle. All rights reserved.