SecretKeyFactorySpi
public abstract class SecretKeyFactorySpi
extends Object
该类为SecretKeyFactory
类定义了 ( SPI )。 该类中的所有抽象方法都必须由每个希望为特定算法提供秘密密钥工厂实现的加密服务提供者来实现。
提供商应记录其密钥工厂支持的所有关键规范。 例如,由“SunJCE”提供商提供的DES密钥工厂支持DESKeySpec
作为DES密钥的透明表示,并且该提供商的Triple DES密钥的密钥工厂支持将DESedeKeySpec
作为Triple DES密钥的透明表示。
Summary
Public constructors
SecretKeyFactorySpi
SecretKeyFactorySpi ()
Protected methods
engineGenerateSecret
SecretKey engineGenerateSecret (KeySpec keySpec)
从提供的密钥规范(密钥材料)中生成一个 SecretKey
对象。
Parameters |
keySpec |
KeySpec : the specification (key material) of the secret key |
Throws |
InvalidKeySpecException |
if the given key specification is inappropriate for this secret-key factory to produce a secret key. |
engineGetKeySpec
KeySpec engineGetKeySpec (SecretKey key,
Class keySpec)
以请求的格式返回给定键对象的规范(键材料)。
Parameters |
key |
SecretKey : the key |
keySpec |
Class : the requested format in which the key material shall be returned |
Returns |
KeySpec |
the underlying key specification (key material) in the requested format |
Throws |
InvalidKeySpecException |
if the requested key specification is inappropriate for the given key (e.g., the algorithms associated with key and keySpec do not match, or key references a key on a cryptographic hardware device whereas keySpec is the specification of a software-based key), or the given key cannot be dealt with (e.g., the given key has an algorithm or format not supported by this secret-key factory). |
engineTranslateKey
SecretKey engineTranslateKey (SecretKey key)
将提供者可能未知或可能不可信的密钥对象转换为此密钥工厂的相应密钥对象。
Parameters |
key |
SecretKey : the key whose provider is unknown or untrusted |