public abstract class ExemptionMechanismSpi
extends Object
| java.lang.Object | |
| javax.crypto.ExemptionMechanismSpi | |
该类定义了ExemptionMechanism类的 ( SPI )。 这个类中的所有抽象方法都必须由每个希望提供特定豁免机制实现的加密服务提供者来实现。
Public constructors |
|
|---|---|
ExemptionMechanismSpi() |
|
Protected methods |
|
|---|---|
abstract byte[] |
engineGenExemptionBlob() 生成豁免机制密钥blob。 |
abstract int |
engineGenExemptionBlob(byte[] output, int outputOffset) 生成豁免机制密钥blob,并将结果存储在 |
abstract int |
engineGetOutputSize(int inputLen) 给定输入长度 |
abstract void |
engineInit(Key key) 使用密钥初始化此免除机制。 |
abstract void |
engineInit(Key key, AlgorithmParameterSpec params) 使用密钥和一组算法参数初始化此免除机制。 |
abstract void |
engineInit(Key key, AlgorithmParameters params) 使用密钥和一组算法参数初始化此免除机制。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
byte[] engineGenExemptionBlob ()
生成豁免机制密钥blob。
| 返回(Returns) | |
|---|---|
byte[] |
the new buffer with the result key blob. |
| 抛出异常(Throws) | |
|---|---|
ExemptionMechanismException |
if problem(s) encountered in the process of generating. |
int engineGenExemptionBlob (byte[] output,
int outputOffset)
生成豁免机制密钥blob,并将结果存储在 output缓冲区中,从 outputOffset开始(包括 outputOffset 。
如果output缓冲区太小而无法保存结果, ShortBufferException引发ShortBufferException 。 在这种情况下,使用更大的输出缓冲区重复此调用。 使用engineGetOutputSize来确定输出缓冲区应该有多大。
| 参数(Parameters) | |
|---|---|
output |
byte: the buffer for the result |
outputOffset |
int: the offset in output where the result is stored |
| 返回(Returns) | |
|---|---|
int |
the number of bytes stored in output |
| 抛出异常(Throws) | |
|---|---|
ShortBufferException |
if the given output buffer is too small to hold the result. |
ExemptionMechanismException |
if problem(s) encountered in the process of generating. |
int engineGetOutputSize (int inputLen)
给定输入长度 inputLen (以字节为单位),返回输出缓冲区需要保留下一个 engineGenExemptionBlob操作结果 inputLen的字节长度。
下一个 engineGenExemptionBlob调用的实际输出长度可能小于此方法返回的长度。
| 参数(Parameters) | |
|---|---|
inputLen |
int: the input length (in bytes) |
| 返回(Returns) | |
|---|---|
int |
the required output buffer size (in bytes) |
void engineInit (Key key)
使用密钥初始化此免除机制。
如果这种免除机制需要任何不能从给定的key派生的算法参数,则底层豁免机制实现本身应该生成所需的参数(使用特定于提供者的默认值); 在算法参数必须由调用者指定的情况下,引发InvalidKeyException 。
| 参数(Parameters) | |
|---|---|
key |
Key: the key for this exemption mechanism |
| 抛出异常(Throws) | |
|---|---|
InvalidKeyException |
if the given key is inappropriate for this exemption mechanism. |
ExemptionMechanismException |
if problem(s) encountered in the process of initializing. |
void engineInit (Key key, AlgorithmParameterSpec params)
使用密钥和一组算法参数初始化此免除机制。
如果此免除机制需要任何算法参数且params为空,则基础豁免机制实现本身应该生成所需的参数(使用特定于提供程序的默认值); 在算法参数必须由调用者指定的情况下,引发InvalidAlgorithmParameterException 。
| 参数(Parameters) | |
|---|---|
key |
Key: the key for this exemption mechanism |
params |
AlgorithmParameterSpec: the algorithm parameters |
| 抛出异常(Throws) | |
|---|---|
InvalidKeyException |
if the given key is inappropriate for this exemption mechanism. |
InvalidAlgorithmParameterException |
if the given algorithm parameters are inappropriate for this exemption mechanism. |
ExemptionMechanismException |
if problem(s) encountered in the process of initializing. |
void engineInit (Key key, AlgorithmParameters params)
使用密钥和一组算法参数初始化此免除机制。
如果此免除机制需要任何算法参数且params为空,则基础豁免机制实现本身应该生成所需的参数(使用提供程序特定的缺省值); 在算法参数必须由调用者指定的情况下,引发InvalidAlgorithmParameterException 。
| 参数(Parameters) | |
|---|---|
key |
Key: the key for this exemption mechanism |
params |
AlgorithmParameters: the algorithm parameters |
| 抛出异常(Throws) | |
|---|---|
InvalidKeyException |
if the given key is inappropriate for this exemption mechanism. |
InvalidAlgorithmParameterException |
if the given algorithm parameters are inappropriate for this exemption mechanism. |
ExemptionMechanismException |
if problem(s) encountered in the process of initializing. |