public abstract class KeyPairGeneratorSpi extends Object
这个类定义了服务提供者接口(SPI)为KeyPairGenerator
类,它是用来生成公钥和私钥对。
在这个类中的所有的抽象方法必须实现由每个密码服务提供商,谁希望提供一个特定的算法的一个密钥对发生器的实现。
如果客户端没有显式初始化KeyPairGenerator(通过调用一个方法,initialize
)每个供应商必须提供一个默认的初始化(文件)。例如,在太阳提供商使用默认的模量大小(1024位的密钥大小)。
Constructor and Description |
---|
KeyPairGeneratorSpi() |
Modifier and Type | Method and Description |
---|---|
abstract KeyPair |
generateKeyPair()
生成一个密钥对。
|
void |
initialize(AlgorithmParameterSpec params, SecureRandom random)
初始化密钥发生器使用指定的参数设置和用户提供的随机源。
|
abstract void |
initialize(int keysize, SecureRandom random)
初始化某个指定密钥长度的密钥对生成,使用默认的参数设置。
|
public abstract void initialize(int keysize, SecureRandom random)
keysize
-密钥大小。这是一个算法的具体指标,如模长度,指定的位数。
random
-这种发生器随机源。
InvalidParameterException
-如果
keysize
是不是这keypairgeneratorspi对象支持。
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
这种具体方法已被添加到这个以前定义的抽象类。(为了向后兼容,它不能是抽象的。)可以被一个提供商初始化密钥对发电机。这样一个覆盖预计如果参数这个密钥对发电机不当引发invalidalgorithmparameterexception。如果这种方法不能被重写,它总是抛出UnsupportedOperationException。
params
-参数设置用于生成密钥。
random
-这种发生器随机源。
InvalidAlgorithmParameterException
如果给定的参数,这个密钥对发电机是不合适的。
public abstract KeyPair generateKeyPair()
KeyPair
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.