public abstract class MaskGenerationAlgorithmSpi
extends java.lang.Object
Mask generation functions are used by the PKCS#1v2.1 PSS signature and OAEP encryption schemes:
A mask generation function takes an octet string of variable length and a desired output length as input, and outputs an octet string of the desired length. There may be restrictions on the length of the input and output octet strings, but such bounds are generally very large. Mask generation functions are deterministic; the octet string output is completely determined by the input octet string. The output of a mask generation function should be pseudo-random: Given one part of the output but not the input, it should be infeasible to predict another part of the output. The provable security of RSAES- OAEP and RSASSA-PSS relies on the random nature of the output of the mask generation function, which in turn relies on the random nature of the underlying hash.
MaskGenerationAlgorithm
Modifier | Constructor and Description |
---|---|
protected |
MaskGenerationAlgorithmSpi()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone if the implementation is cloneable.
|
protected abstract java.security.AlgorithmParameters |
engineGetParameters()
SPI: Gets the algorithm parameters required by this MGF engine.
|
protected abstract void |
engineMask(byte[] mgfSeed,
int mgfSeedOff,
int mgfSeedLen,
int maskLen,
byte[] dst,
int dstOff)
SPI: Uses the mask generation function to generate maskLen bytes
from the supplied seed mgfSeed[mgfSeedOff:mgfSeedLen] and XORs the result
with dst[off:maskLen].
|
protected abstract void |
engineReset()
SPE: Resets this engine to the state before
engineMask
has been called. |
protected abstract void |
engineSetParameters(java.security.AlgorithmParameters params)
SPI: Sets any algorithm parameters required by this MGF engine.
|
protected abstract void |
engineSetParameters(java.security.spec.AlgorithmParameterSpec paramSpec)
SPI: Sets any algorithm parameters required by this MGF engine.
|
protected MaskGenerationAlgorithmSpi()
protected abstract void engineSetParameters(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.InvalidAlgorithmParameterException
paramSpec
- the parameters to be setjava.security.InvalidAlgorithmParameterException
- if the parameters are inappropriate for this engine or are
invalidprotected abstract void engineSetParameters(java.security.AlgorithmParameters params) throws java.security.InvalidAlgorithmParameterException
params
- the parameters to be setjava.security.InvalidAlgorithmParameterException
- if the parameters are inappropriate for this engine or are
invalidprotected abstract java.security.AlgorithmParameters engineGetParameters()
protected abstract void engineMask(byte[] mgfSeed, int mgfSeedOff, int mgfSeedLen, int maskLen, byte[] dst, int dstOff)
mgfSeed
- the seed from which the mask is generatedmgfSeedOff
- the offset indicating the start position within the seed arraymgfSeedLen
- the actual number of seed bytesmaskLen
- the number of required mask bytesdst
- the destination array to which to XOR the mask resultdstOff
- the offset indicating the start position within the destination
arrayprotected abstract void engineReset()
engineMask
has been called.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if this is called on an implementation that does not support
Cloneable
.