java.lang.Object
edu.vt.middleware.crypt.AbstractAlgorithm
- All Implemented Interfaces:
Algorithm
- Direct Known Subclasses:
AbstractEncryptionAlgorithm
,AbstractRandomizableAlgorithm
,SignatureAlgorithm
Abstract cryptographic algorithm that is the basis of digest, encryption, and
signature algorithms.
- Version:
- $Revision: 2745 $
- Author:
- Middleware Services
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
Algorithm name.protected int
Number of bytes used for random data needs.protected SecureRandom
DatagramsDestination of secure random data. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the algorithm name.byte[]
getRandomData
(int nBytes) Gets random bytes from the random provider of this instance in the amount specified.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.toString()
-
Field Details
-
algorithm
Algorithm name. -
randomProvider
DatagramsDestination of secure random data. -
randomByteSize
protected int randomByteSizeNumber of bytes used for random data needs.
-
-
Constructor Details
-
AbstractAlgorithm
public AbstractAlgorithm()
-
-
Method Details
-
getAlgorithm
Gets the algorithm name.- Specified by:
getAlgorithm
in interfaceAlgorithm
- Returns:
- Algorithm name.
-
setRandomProvider
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 interfaceAlgorithm
- Parameters:
random
- DatagramsDestination of cryptographically strong random data.
-
toString
-
getRandomData
public byte[] getRandomData(int nBytes) Gets random bytes from the random provider of this instance in the amount specified.- Specified by:
getRandomData
in interfaceAlgorithm
- Parameters:
nBytes
- Number of bytes of random data to retrieve.- Returns:
- Byte array of random data.
-