public abstract class MacSpi
extends Object
| java.lang.Object | |
| javax.crypto.MacSpi | |
该类定义了Mac类的 ( SPI )。 这个类中的所有抽象方法都必须由希望提供特定MAC算法实现的每个加密服务提供者来实现。
实现可以自由实现Cloneable接口。
Public constructors |
|
|---|---|
MacSpi() |
|
公共方法(Public methods) |
|
|---|---|
Object |
clone() 如果实现可复制,则返回一个克隆。 |
Protected methods |
|
|---|---|
abstract byte[] |
engineDoFinal() 完成MAC计算并重置MAC以供进一步使用,并保留MAC初始化的密钥。 |
abstract int |
engineGetMacLength() 以字节为单位返回MAC的长度。 |
abstract void |
engineInit(Key key, AlgorithmParameterSpec params) 用给定(秘密)密钥和算法参数初始化MAC。 |
abstract void |
engineReset() 重置MAC以备后用,保持MAC初始化的密钥。 |
void |
engineUpdate(ByteBuffer input) 处理 |
abstract void |
engineUpdate(byte input) 处理给定的字节。 |
abstract void |
engineUpdate(byte[] input, int offset, int len) 处理第一 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
Object clone ()
如果实现可复制,则返回一个克隆。
| 返回(Returns) | |
|---|---|
Object |
a clone if the implementation is cloneable. |
| 抛出异常(Throws) | |
|---|---|
CloneNotSupportedException |
if this is called on an implementation that does not support Cloneable. |
byte[] engineDoFinal ()
完成MAC计算并重置MAC以供进一步使用,并保留MAC初始化的密钥。
| 返回(Returns) | |
|---|---|
byte[] |
the MAC result. |
int engineGetMacLength ()
以字节为单位返回MAC的长度。
| 返回(Returns) | |
|---|---|
int |
the MAC length in bytes. |
void engineInit (Key key, AlgorithmParameterSpec params)
用给定(秘密)密钥和算法参数初始化MAC。
| 参数(Parameters) | |
|---|---|
key |
Key: the (secret) key. |
params |
AlgorithmParameterSpec: the algorithm parameters. |
| 抛出异常(Throws) | |
|---|---|
InvalidKeyException |
if the given key is inappropriate for initializing this MAC. |
InvalidAlgorithmParameterException |
if the given algorithm parameters are inappropriate for this MAC. |
void engineUpdate (ByteBuffer input)
处理input.remaining()在ByteBuffer的字节input ,起始于input.position() 。 返回时,缓冲区的位置将等于它的极限; 其限制不会改变。
如果子类可以比字节数组更有效地处理ByteBuffers,则子类应考虑覆盖此方法。
| 参数(Parameters) | |
|---|---|
input |
ByteBuffer: the ByteBuffer |
void engineUpdate (byte input)
处理给定的字节。
| 参数(Parameters) | |
|---|---|
input |
byte: the input byte to be processed. |
void engineUpdate (byte[] input,
int offset,
int len)
处理第一 len字节 input ,起始于 offset以下。
| 参数(Parameters) | |
|---|---|
input |
byte: the input buffer. |
offset |
int: the offset in input where the input starts. |
len |
int: the number of bytes to process. |