Most visited

Recently visited

Added in API level 1

PKCS8EncodedKeySpec

public class PKCS8EncodedKeySpec
extends EncodedKeySpec

java.lang.Object
   ↳ java.security.spec.EncodedKeySpec
     ↳ java.security.spec.PKCS8EncodedKeySpec


该类表示私钥的ASN.1编码,按照ASN.1类型PrivateKeyInfo编码。 PrivateKeyInfo语法在PKCS#8标准中定义如下:

 PrivateKeyInfo ::= SEQUENCE {
   version Version,
   privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
   privateKey PrivateKey,
   attributes [0] IMPLICIT Attributes OPTIONAL }

 Version ::= INTEGER

 PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier

 PrivateKey ::= OCTET STRING

 Attributes ::= SET OF Attribute
 

也可以看看:

Summary

Public constructors

PKCS8EncodedKeySpec(byte[] encodedKey)

用给定的编码密钥创建一个新的PKCS8EncodedKeySpec。

Public methods

byte[] getEncoded()

返回按照PKCS#8标准编码的关键字节。

final String getFormat()

返回与此密钥规范关联的编码格式的名称。

Inherited methods

From class java.security.spec.EncodedKeySpec
From class java.lang.Object

Public constructors

PKCS8EncodedKeySpec

Added in API level 1
PKCS8EncodedKeySpec (byte[] encodedKey)

用给定的编码密钥创建一个新的PKCS8EncodedKeySpec。

Parameters
encodedKey byte: the key, which is assumed to be encoded according to the PKCS #8 standard. The contents of the array are copied to protect against subsequent modification.
Throws
NullPointerException if encodedKey is null.

Public methods

getEncoded

Added in API level 1
byte[] getEncoded ()

返回按照PKCS#8标准编码的关键字节。

Returns
byte[] the PKCS #8 encoding of the key. Returns a new array each time this method is called.

getFormat

Added in API level 1
String getFormat ()

返回与此密钥规范关联的编码格式的名称。

Returns
String the string "PKCS#8".

Hooray!