|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.crypto.EncryptedPrivateKeyInfo
public class EncryptedPrivateKeyInfo
此類別實作 EncryptedPrivateKeyInfo 型別,如在 PKCS #8 中定義的那樣。
它的 ASN.1 定義如下:
EncryptedPrivateKeyInfo ::= SEQUENCE {
encryptionAlgorithm AlgorithmIdentifier,
encryptedData OCTET STRING }
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL }
PKCS8EncodedKeySpec| 建構子摘要 | |
|---|---|
EncryptedPrivateKeyInfo(AlgorithmParameters algParams,
byte[] encryptedData)
根據加密演算法參數和加密資料建構 EncryptedPrivateKeyInfo。 |
|
EncryptedPrivateKeyInfo(byte[] encoded)
根據其 ASN.1 編碼建構(即解析) EncryptedPrivateKeyInfo。 |
|
EncryptedPrivateKeyInfo(String algName,
byte[] encryptedData)
根據加密演算法名稱和加密資料建構 EncryptedPrivateKeyInfo。 |
|
| 方法摘要 | |
|---|---|
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 物件從加密的資料中抽取出來並將其返回。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public EncryptedPrivateKeyInfo(byte[] encoded)
throws IOException
EncryptedPrivateKeyInfo。
encoded - 此物件的 ASN.1 編碼。該陣列的內容被複製,以免後續修改。
NullPointerException - 如果 encoded 為 null。
IOException - 如果在解析 ASN.1 編碼過程中出現錯誤。
public EncryptedPrivateKeyInfo(String algName,
byte[] encryptedData)
throws NoSuchAlgorithmException
EncryptedPrivateKeyInfo。
註:此建構子將用 null 充當演算法參數的值。如果加密演算法所帶的參數不為 null,則應換一種建構子使用,例如,EncryptedPrivateKeyInfo(AlgorithmParameters, byte[])。
algName - 加密演算法名稱。有關標準 Cipher 演算法名稱的資訊,請參見
Java Cryptography Architecture Reference Guide 中的附錄 A。encryptedData - 加密資料。encrypedData 的內容被複製,以免建構此物件時出現後續修改。
NullPointerException - 如果 algName 或 encryptedData 為 null。
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 為 null。
IllegalArgumentException - 如果 encryptedData 為空,即長度為 0。
NoSuchAlgorithmException - 如果的指定的 algParams 參數的指定 algName 不受支持。| 方法詳細資訊 |
|---|
public String getAlgName()
註:如果有這樣的映射可用,則返回標準名稱而不是指定的名稱。有關標準 Cipher 演算法名稱的資訊,請參見 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 為 null。
InvalidKeySpecException - 如果給定的密碼不適合加密的資料,或者加密的資料已損壞,無法解密。
public PKCS8EncodedKeySpec getKeySpec(Key decryptKey)
throws NoSuchAlgorithmException,
InvalidKeyException
decryptKey - 在對加密的資料進行解密時所使用的密鑰。
NullPointerException - 如果 decryptKey 為 null。
NoSuchAlgorithmException - 如果無法找到合適的密碼對加密的資料進行解密。
InvalidKeyException - 如果無法用 decryptKey 對加密的資料進行解密,或者解密結果不是有效的 PKCS8KeySpec。
public PKCS8EncodedKeySpec getKeySpec(Key decryptKey,
String providerName)
throws NoSuchProviderException,
NoSuchAlgorithmException,
InvalidKeyException
decryptKey - 在對加密的資料進行解密時所使用的密鑰。providerName - 其 Cipher 實作將被使用的提供者的名稱。
NullPointerException - 如果 decryptKey 或 providerName 為 null。
NoSuchProviderException - 如果沒有註冊任何名稱為 providerName 的提供者。
NoSuchAlgorithmException - 如果無法找到合適的密碼對加密的資料進行解密。
InvalidKeyException - 如果無法用 decryptKey 對加密的資料進行解密,或者解密結果不是有效的 PKCS8KeySpec。
public PKCS8EncodedKeySpec getKeySpec(Key decryptKey,
Provider provider)
throws NoSuchAlgorithmException,
InvalidKeyException
decryptKey - 在對加密的資料進行解密時所使用的密鑰。provider - 其 Cipher 實作將被使用的提供者的名稱。
NullPointerException - 如果 decryptKey 或 provider 為 null。
NoSuchAlgorithmException - 如果在 provider 中無法找到合適的密碼對加密的資料進行解密。
InvalidKeyException - 如果無法用 decryptKey 對加密的資料進行解密,或者解密結果不是有效的 PKCS8KeySpec。
public byte[] getEncoded()
throws IOException
IOException - 如果在建構 ASN.1 編碼過程中發生錯誤。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。