|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.security.AlgorithmParameters
public class AlgorithmParameters
此類別用作密碼參數的不透明表示形式。
可以通過調用 getInstance 處理器方法(返回給定類別的實例的 static 方法)之一獲取用於管理特定演算法的參數的 AlgorithmParameters 物件。
返回 AlgorithmParameters 物件後,必須使用適當的參數規範或參數編碼通過調用 init 方法初始化該物件。
通過調用 getParameterSpec 可以從 AlgorithmParameters 物件獲取透明參數規範,可以通過調用 getEncoded 獲取參數的位元組編碼。
AlgorithmParameterSpec,
DSAParameterSpec,
KeyPairGenerator| 建構子摘要 | |
|---|---|
protected |
AlgorithmParameters(AlgorithmParametersSpi paramSpi,
Provider provider,
String algorithm)
創建一個 AlgorithmParameters 物件。 |
| 方法摘要 | ||
|---|---|---|
String |
getAlgorithm()
返回與此參數物件關聯的演算法的名稱。 |
|
byte[] |
getEncoded()
返回基本編碼格式的參數。 |
|
byte[] |
getEncoded(String format)
返回以指定方案編碼的參數。 |
|
static AlgorithmParameters |
getInstance(String algorithm)
返回指定演算法的參數物件。 |
|
static AlgorithmParameters |
getInstance(String algorithm,
Provider provider)
返回指定演算法的參數物件。 |
|
static AlgorithmParameters |
getInstance(String algorithm,
String provider)
返回指定演算法的參數物件。 |
|
|
getParameterSpec(Class<T> paramSpec)
返回此參數物件的(透明)規範。 |
|
Provider |
getProvider()
返回此參數物件的提供者。 |
|
void |
init(AlgorithmParameterSpec paramSpec)
使用在 paramSpec 中指定的參數初始化此參數物件。 |
|
void |
init(byte[] params)
根據參數的基本解碼格式導入指定的參數並對其解碼。 |
|
void |
init(byte[] params,
String format)
根據指定的解碼方案從 params 導入參數並對其解碼。 |
|
String |
toString()
返回描述參數的格式化字元串。 |
|
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 建構子詳細資訊 |
|---|
protected AlgorithmParameters(AlgorithmParametersSpi paramSpi,
Provider provider,
String algorithm)
paramSpi - 委託provider - 提供者algorithm - 演算法| 方法詳細資訊 |
|---|
public final String getAlgorithm()
public static AlgorithmParameters getInstance(String algorithm)
throws NoSuchAlgorithmException
此方法從首選 Provider 開始,遍歷已註冊安全提供者列表。返回一個封裝 AlgorithmParametersSpi 實作的新 AlgorithmParameters 物件,該實作取自第一個支持指定演算法的 Provider。
注意,已註冊提供者列表可以通過 Security.getProviders() 方法獲得。
必須使用適當參數規範或參數編碼通過調用 init 方法初始化返回的參數物件。
algorithm - 所請求演算法的名稱。有關標準演算法名稱的資訊,請參閱
Java Cryptography Architecture API Specification & Reference 的附錄 A。
NoSuchAlgorithmException - 如果沒有任何 Provider 支持指定演算法的 AlgorithmParametersSpi 實作。Provider
public static AlgorithmParameters getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException,
NoSuchProviderException
返回一個封裝 AlgorithmParametersSpi 實作的新 AlgorithmParameters 物件,該實作取自指定的提供者。指定的提供者必須已經在安全提供者列表中註冊。
注意,已註冊提供者列表可以使用 Security.getProviders() 方法獲得。
algorithm - 所請求演算法的名稱。有關標準演算法名稱的資訊,請參閱
Java Cryptography Architecture API Specification & Reference 的附錄 A。provider - 提供者的名稱。
NoSuchAlgorithmException - 如果無法從指定提供者獲得指定演算法的 AlgorithmParametersSpi 實作。
NoSuchProviderException - 如果指定提供者沒有在安全提供者列表中註冊。
IllegalArgumentException - 如果提供者的名稱為 null 或空。Provider
public static AlgorithmParameters getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
返回一個封裝 AlgorithmParametersSpi 實作的新 AlgorithmParameters 物件,該實作取自指定的 Provider 物件。注意,指定的 Provider 物件無需在提供者列表中註冊。
必須使用適當參數規範或參數編碼通過調用 init 方法初始化返回的參數物件。
algorithm - 所請求演算法的名稱。有關標準演算法名稱的資訊,請參閱
Java Cryptography Architecture API Specification & Reference 的附錄 A。provider - 提供者的名稱。
NoSuchAlgorithmException - 如果無法從指定 Provider 物件獲得指定演算法的 AlgorithmParametersSpi 實作。
IllegalArgumentException - 如果 provider 為 null。Providerpublic final Provider getProvider()
public final void init(AlgorithmParameterSpec paramSpec)
throws InvalidParameterSpecException
paramSpec 中指定的參數初始化此參數物件。
paramSpec - 參數規範。
InvalidParameterSpecException - 如果給定的參數規範不適用於初始化此參數物件,或者已經初始化此參數物件。
public final void init(byte[] params)
throws IOException
params - 編碼的參數。
IOException - 如果發生解碼錯誤,或者已經初始化此參數物件。
public final void init(byte[] params,
String format)
throws IOException
params 導入參數並對其解碼。如果 format 為 null,則使用參數的基本解碼格式。如果這些參數的 ASN.1 規範存在,則基本解碼格式為 ASN.1。
params - 編碼的參數。format - 解碼方案的名稱。
IOException - 如果發生解碼錯誤,或者已經初始化此參數物件。
public final <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
throws InvalidParameterSpecException
paramSpec 標識應該在其中返回參數的規範類別。例如,該類別可以為 DSAParameterSpec.class,指示應該在 DSAParameterSpec 類別的實例中返回參數。
paramSpec - 應該在其中返回參數的規範類別。
InvalidParameterSpecException - 如果請求的參數規範不適合此參數物件,或者尚未初始化此參數物件。
public final byte[] getEncoded()
throws IOException
IOException - 如果發生編碼錯誤,或者尚未初始化此參數物件。
public final byte[] getEncoded(String format)
throws IOException
format 為 null,則使用參數的基本編碼格式。如果這些參數的 ASN.1 規範存在,則基本編碼格式為 ASN.1。
format - 編碼格式的名稱。
IOException - 如果發生編碼錯誤,或者尚未初始化此參數物件。public final String toString()
Object 中的 toString
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。