- 封装接口:
-
KEMSpi
public static interface KEMSpi.DecapsulatorSpi
由KEM接收方的
KEMSpi.engineNewDecapsulator(java.security.PrivateKey, java.security.spec.AlgorithmParameterSpec)生成的KEM解封装器实现。
- 自:
- 21
- 参见:
-
Method Summary
Modifier and TypeMethodDescriptionengineDecapsulate(byte[] encapsulation, int from, int to, String algorithm) 密钥解封装函数。int返回密钥封装消息的大小。int返回共享密钥的大小。
-
Method Details
-
engineDecapsulate
SecretKey engineDecapsulate(byte[] encapsulation, int from, int to, String algorithm) throws DecapsulateException 密钥解封装函数。调用此方法从密钥封装消息中恢复密钥。
实现必须支持
from为0,to与secretSize()的返回值相同,algorithm为"Generic"的情况。- 参数:
-
encapsulation- 发送方的密钥封装消息。大小必须等于engineEncapsulationSize()返回的值,否则必须抛出DecapsulateException。 -
from- 要返回的共享密钥字节数组的初始索引(包括) -
to- 要返回的共享密钥字节数组的最终索引(不包括) -
algorithm- 返回的密钥的算法名称 - 返回:
-
作为指定算法的
SecretKey的共享密钥部分 - 抛出:
-
DecapsulateException- 如果解封装过程中发生错误 -
IndexOutOfBoundsException- 如果from < 0,from > to或to > secretSize() -
NullPointerException- 如果encapsulation或algorithm为null -
UnsupportedOperationException- 如果解封装器不支持from,to和algorithm的组合 - 参见:
-
engineSecretSize
int engineSecretSize()返回共享密钥的大小。- 返回:
- 作为有限非负整数的共享密钥的大小
- 参见:
-
engineEncapsulationSize
int engineEncapsulationSize()返回密钥封装消息的大小。- 返回:
- 作为有限非负整数的密钥封装消息的大小
- 参见:
-