public class EncryptedPrivateKeyInfo extends Object
EncryptedPrivateKeyInfo类型。 
       其ASN.1定义如下:
  EncryptedPrivateKeyInfo ::=  SEQUENCE {
     encryptionAlgorithm   AlgorithmIdentifier,
     encryptedData   OCTET STRING }
 AlgorithmIdentifier  ::=  SEQUENCE  {
     algorithm              OBJECT IDENTIFIER,
     parameters             ANY DEFINED BY algorithm OPTIONAL  }  
      PKCS8EncodedKeySpec 
       | Constructor and Description | 
|---|
| EncryptedPrivateKeyInfo(AlgorithmParameters algParams, byte[] encryptedData)
              构造一个 
              EncryptedPrivateKeyInfo从加密算法参数和加密数据。 | 
| EncryptedPrivateKeyInfo(byte[] encoded)
              从其ASN.1编码构造(即解析) 
              EncryptedPrivateKeyInfo。 | 
| EncryptedPrivateKeyInfo(String algName, byte[] encryptedData)
              构造一个 
              EncryptedPrivateKeyInfo从加密算法的名称和加密的数据。 | 
| Modifier and Type | Method and Description | 
|---|---|
| String | getAlgName()
              返回加密算法。 
             | 
| AlgorithmParameters | getAlgParameters()
              返回加密算法使用的算法参数。 
             | 
| byte[] | getEncoded()
              返回此对象的ASN.1编码。 
             | 
| byte[] | getEncryptedData()
              返回加密数据。 
             | 
| PKCS8EncodedKeySpec | getKeySpec(Cipher cipher)
              从加密数据中提取封闭的PKCS8EncodedKeySpec对象并返回。 
             | 
| PKCS8EncodedKeySpec | getKeySpec(Key decryptKey)
              从加密数据中提取封闭的PKCS8EncodedKeySpec对象并返回。 
             | 
| PKCS8EncodedKeySpec | getKeySpec(Key decryptKey, Provider provider)
              从加密数据中提取封闭的PKCS8EncodedKeySpec对象并返回。 
             | 
| PKCS8EncodedKeySpec | getKeySpec(Key decryptKey, String providerName)
              从加密数据中提取封闭的PKCS8EncodedKeySpec对象并返回。 
             | 
public EncryptedPrivateKeyInfo(byte[] encoded)
                        throws IOException 
          EncryptedPrivateKeyInfo 。 
          encoded - 该对象的ASN.1编码。 
            复制数组的内容以防止后续修改。 
           NullPointerException - 如果 
            encoded为空。 
           IOException - 如果在解析ASN.1编码时发生错误。 
           public EncryptedPrivateKeyInfo(String algName, byte[] encryptedData) throws NoSuchAlgorithmException
EncryptedPrivateKeyInfo从加密算法的名称和加密的数据。 
           注意:该构造函数将使用null作为算法参数的值。 如果加密算法的参数值不为空,则应使用不同的构造函数,例如EncryptedPrivateKeyInfo(AlgorithmParameters,byte [])。
algName - 加密算法名称。 
            有关标准密码算法名称的信息,请参阅Java Cryptography Architecture Reference Guide中的附录A. 
           encryptedData - 加密数据。 
            复制encrypedData的内容以防止在构建此对象时进行后续修改。 
           NullPointerException - 如果 
            algName或 
            encryptedData为空。 
           IllegalArgumentException - 如果 
            encryptedData为空,即0长度。 
           NoSuchAlgorithmException - 如果不支持指定的algName。 
           public EncryptedPrivateKeyInfo(AlgorithmParameters algParams, byte[] encryptedData) throws NoSuchAlgorithmException
EncryptedPrivateKeyInfo从加密算法参数和加密数据。 
          algParams - 加密算法的算法参数。 
            algParams.getEncoded()应该返回EncryptedPrivateKeyInfo类型的AlgorithmIdentifer组件的parameters字段的ASN.1编码字节。 
           encryptedData - 加密数据。 
            复制encrypedData的内容以防止在构建此对象时进行后续修改。 
           NullPointerException - 如果 
            algParams或 
            encryptedData为空。 
           IllegalArgumentException - 如果 
            encryptedData为空,即0长度。 
           NoSuchAlgorithmException - 如果不支持指定的指定的algName 
            algParams algParams参数。 
           public String getAlgName()
注意:如果此类映射可用,则在构造函数中返回标准名称而不是指定的名称。 有关标准密码算法名称的信息,请参阅Java Cryptography Architecture Reference Guide中的附录A.
public AlgorithmParameters getAlgParameters()
public byte[] getEncryptedData()
public PKCS8EncodedKeySpec getKeySpec(Cipher cipher) throws InvalidKeySpecException
cipher需要初始化为Cipher.DECRYPT_MODE或Cipher.UNWRAP_MODE,具有与生成加密数据相同的密钥和参数。 
          cipher - 将用于解密加密数据的初始化密码对象。 
           NullPointerException - 如果 
            cipher为空。 
           InvalidKeySpecException - 如果给定的密码对于加密数据不合适或加密数据被破坏并且不能被解密。 
           public PKCS8EncodedKeySpec getKeySpec(Key decryptKey) throws NoSuchAlgorithmException, InvalidKeyException
decryptKey - 用于解密加密数据的密钥。 
           NullPointerException - 如果 
            decryptKey为空。 
           NoSuchAlgorithmException - 如果找不到适当的密码来解密加密数据。 
           InvalidKeyException - 如果 
            decryptKey不能用于解密加密数据或解密结果不是有效的PKCS8KeySpec。 
           public PKCS8EncodedKeySpec getKeySpec(Key decryptKey, String providerName) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException
decryptKey - 用于解密加密数据的密钥。 
           providerName - 将使用Cipher实现的提供程序的名称。 
           NullPointerException - 如果 
            decryptKey或 
            providerName为空。 
           NoSuchProviderException - 如果没有提供者 
            providerName被注册。 
           NoSuchAlgorithmException - 如果找不到适当的密码来解密加密数据。 
           InvalidKeyException - 如果 
            decryptKey不能用于解密加密数据或解密结果不是有效的PKCS8KeySpec。 
           public PKCS8EncodedKeySpec getKeySpec(Key decryptKey, Provider provider) throws NoSuchAlgorithmException, InvalidKeyException
decryptKey - 用于解密加密数据的密钥。 
           provider - 将使用Cipher实现的提供者的名称。 
           NullPointerException - 如果 
            decryptKey或 
            provider为空。 
           NoSuchAlgorithmException -如果无法找到合适的密码在对加密数据 
            provider 。 
           InvalidKeyException - 如果 
            decryptKey不能用于解密加密数据或解密结果不是有效的PKCS8KeySpec。 
           public byte[] getEncoded()
                  throws IOException 
          IOException - 如果构建其ASN.1编码时发生错误。 
            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.