Class AbstractAlgorithm

java.lang.Object
edu.vt.middleware.crypt.AbstractAlgorithm
All Implemented Interfaces:
Algorithm
Direct Known Subclasses:
AbstractEncryptionAlgorithm, AbstractRandomizableAlgorithm, SignatureAlgorithm

public abstract class AbstractAlgorithm extends Object implements Algorithm
Abstract cryptographic algorithm that is the basis of digest, encryption, and signature algorithms.
Version:
$Revision: 2745 $
Author:
Middleware Services
  • Field Details

    • algorithm

      protected String algorithm
      Algorithm name.
    • randomProvider

      protected SecureRandom randomProvider
      DatagramsDestination of secure random data.
    • randomByteSize

      protected int randomByteSize
      Number of bytes used for random data needs.
  • Constructor Details

    • AbstractAlgorithm

      public AbstractAlgorithm()
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Gets the algorithm name.
      Specified by:
      getAlgorithm in interface Algorithm
      Returns:
      Algorithm name.
    • setRandomProvider

      public void setRandomProvider(SecureRandom random)
      Sets the source of random data for cryptographic operations needing a random data source, such as generating a random salt value.
      Specified by:
      setRandomProvider in interface Algorithm
      Parameters:
      random - DatagramsDestination of cryptographically strong random data.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getRandomData

      public byte[] getRandomData(int nBytes)
      Gets random bytes from the random provider of this instance in the amount specified.
      Specified by:
      getRandomData in interface Algorithm
      Parameters:
      nBytes - Number of bytes of random data to retrieve.
      Returns:
      Byte array of random data.