Most visited

Recently visited

Added in API level 1

KeyPair

public final class KeyPair
extends Object implements Serializable

java.lang.Object
    java.security.KeyPair


这个类是一个简单的密钥对(公钥和私钥)的持有者。 它没有强制执行任何安全措施,并且在初始化时应该像PrivateKey一样对待。

也可以看看:

摘要(Summary)

Public constructors

KeyPair(PublicKey publicKey, PrivateKey privateKey)

从给定的公钥和私钥构造一个密钥对。

公共方法(Public methods)

PrivateKey getPrivate()

返回对此密钥对的私钥组件的引用。

PublicKey getPublic()

返回对此密钥对的公钥组件的引用。

继承方法(Inherited methods)

From class java.lang.Object

Public constructors

KeyPair

Added in API level 1
KeyPair (PublicKey publicKey, 
                PrivateKey privateKey)

从给定的公钥和私钥构造一个密钥对。

请注意,此构造函数仅存储对生成的密钥对中的公钥和私钥组件的引用。 这是安全的,因为Key对象是不可变的。

参数(Parameters)
publicKey PublicKey: the public key.
privateKey PrivateKey: the private key.

公共方法(Public methods)

getPrivate

Added in API level 1
PrivateKey getPrivate ()

返回对此密钥对的私钥组件的引用。

返回(Returns)
PrivateKey a reference to the private key.

getPublic

Added in API level 1
PublicKey getPublic ()

返回对此密钥对的公钥组件的引用。

返回(Returns)
PublicKey a reference to the public key.

Hooray!