|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.xml.crypto.dsig.keyinfo.KeyInfoFactory
public abstract class KeyInfoFactory
用於從頭創建 KeyInfo 物件或從相應的 XML 表示形式解組 KeyInfo 物件的處理器。
每個 KeyInfoFactory 實例都支持一個特定的 XML 機制型別。要創建 KeyInfoFactory,則需要調用一個靜態 getInstance 方法,並傳入所需的 XML 機制型別,例如:
KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
此處理器產生的物件將基於 DOM 並遵守 DOM 互操作性要求,正如 API 概觀的 DOM Mechanism Requirements 部分所定義的。有關標準機制型別列表,請參閱 API 概觀的 Service Providers 部分。
使用 Provider 機制來註冊和載入 KeyInfoFactory 實作。例如,支持 DOM 機制的服務提供者將在 Provider 子類別中指定,如下所示:
put("KeyInfoFactory.DOM", "org.example.DOMKeyInfoFactory");
同時,由此處理器創建的 XMLStructure 可能包含特定於 KeyInfo 的狀態,並且該狀態是不可重用的。
實作至少必須支持預設的機制型別:DOM。
注意,調用者必須使用相同的 KeyInfoFactory 實例來創建特定 KeyInfo 物件的 XMLStructure。如果同時使用來自不同提供者或不同機制型別的 XMLStructure,則行為是不明確的。
共時存取
可保證此類別的靜態方法是執行緒安全的。多個執行緒可以共時調用此類別中所定義的靜態方法,而不會產生不良效果。
但是,對於此類別所定義的非靜態方法並非如此。除非具體的提供者另行指定,否則需要共時存取單個 KeyInfoFactory 實例的多個執行緒應該在它們之間實作同步並提供所需的鎖定。對於每個執行緒都操作一個不同 KeyInfoFactory 實例的多個執行緒而言,無需實作同步。
| 建構子摘要 | |
|---|---|
protected |
KeyInfoFactory()
預設的建構子,由子類別調用。 |
| 方法摘要 | |
|---|---|
static KeyInfoFactory |
getInstance()
返回支持預設 XML 處理機制和表示形式型別(“DOM”) 的 KeyInfoFactory。 |
static KeyInfoFactory |
getInstance(String mechanismType)
返回 KeyInfoFactory,它支持指定的 XML 處理機制和表示形式型別(比如:“DOM”)。 |
static KeyInfoFactory |
getInstance(String mechanismType,
Provider provider)
返回支持所需的 XML 處理機制和表示形式型別(比如:“DOM”)的 KeyInfoFactory,由指定提供者提供。 |
static KeyInfoFactory |
getInstance(String mechanismType,
String provider)
返回支持所需的 XML 處理機制和表示形式型別(比如:“DOM”)的 KeyInfoFactory,由指定提供者提供。 |
String |
getMechanismType()
返回此 KeyInfoFactory 支持的 XML 處理機制型別和表示形式型別(比如:“DOM”)。 |
Provider |
getProvider()
返回此 KeyInfoFactory 的提供者。 |
abstract URIDereferencer |
getURIDereferencer()
返回對 URIDereferencer 的參考,預設情況下用於取消參考 RetrievalMethod 物件中的 URI。 |
abstract boolean |
isFeatureSupported(String feature)
指示是否支持指定的功能。 |
abstract KeyInfo |
newKeyInfo(List content)
創建包含指定的密鑰資訊型別列表的 KeyInfo。 |
abstract KeyInfo |
newKeyInfo(List content,
String id)
創建包含指定的密鑰資訊型別列表和可選 id 的 KeyInfo。 |
abstract KeyName |
newKeyName(String name)
根據指定的名稱創建 KeyName。 |
abstract KeyValue |
newKeyValue(PublicKey key)
根據指定的公鑰創建 KeyValue。 |
abstract PGPData |
newPGPData(byte[] keyId)
根據指定的 PGP 公鑰標識符創建 PGPData。 |
abstract PGPData |
newPGPData(byte[] keyId,
byte[] keyPacket,
List other)
根據指定的 PGP 公鑰標識符、可選的密鑰材料包和外部元素的列表,創建 PGPData。 |
abstract PGPData |
newPGPData(byte[] keyPacket,
List other)
根據指定的 PGP 密鑰材料包和可選的外部元素列表創建 PGPData。 |
abstract RetrievalMethod |
newRetrievalMethod(String uri)
根據指定的 URI 創建 RetrievalMethod。 |
abstract RetrievalMethod |
newRetrievalMethod(String uri,
String type,
List transforms)
根據指定的參數創建 RetrievalMethod。 |
abstract X509Data |
newX509Data(List content)
創建包含指定的 X.509 內容列表的 X509Data。 |
abstract X509IssuerSerial |
newX509IssuerSerial(String issuerName,
BigInteger serialNumber)
根據指定的 X.500 發佈方標識名和序列號創建 X509IssuerSerial。 |
abstract KeyInfo |
unmarshalKeyInfo(XMLStructure xmlStructure)
根據特定於機制的 XMLStructure(比如:DOMStructure)實例解組新的 KeyInfo 實例。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
protected KeyInfoFactory()
| 方法詳細資訊 |
|---|
public static KeyInfoFactory getInstance(String mechanismType)
KeyInfoFactory,它支持指定的 XML 處理機制和表示形式型別(比如:“DOM”)。
此方法使用標準的 JCA 提供者尋找機制來尋找並實例化所需機制型別的 KeyInfoFactory 實作。它將從首選的 Provider 開始,遍歷已註冊的安全 Provider 的列表。返回取自第一個支持指定機制的 Provider 中的新 KeyInfoFactory 物件。
注意,已註冊提供者的列表可以通過 Security.getProviders() 方法獲得。
mechanismType - XML 處理機制和表示形式的型別。有關標準機制型別列表,請參閱 API 概觀的 Service Providers 部分。
KeyInfoFactory
NullPointerException - 如果 mechanismType 為 null
NoSuchMechanismException - 如果沒有任何 Provider 支持指定機制的 KeyInfoFactory 實作Provider
public static KeyInfoFactory getInstance(String mechanismType,
Provider provider)
KeyInfoFactory,由指定提供者提供。注意,指定的 Provider 物件不必已經在提供者列表中註冊。
mechanismType - XML 處理機制和表示形式的型別。有關標準機制型別列表,請參閱 API 概觀的 Service Providers 部分。provider - Provider 物件
KeyInfoFactory
NullPointerException - 如果 mechanismType 或 provider 為 null
NoSuchMechanismException - 如果不能從指定的 Provider 物件使用指定機制的 KeyInfoFactory 實作Provider
public static KeyInfoFactory getInstance(String mechanismType,
String provider)
throws NoSuchProviderException
KeyInfoFactory,由指定提供者提供。指定的提供者必須已在安全提供者列表中註冊。
注意,已註冊提供者的列表可以通過 Security.getProviders() 方法獲得。
mechanismType - XML 處理機制和表示形式的型別。有關標準機制型別列表,請參閱 API 概觀的 Service Providers 部分。provider - 提供者的字元串名稱
KeyInfoFactory
NoSuchProviderException - 如果指定的提供者沒有在安全提供者列表中註冊
NullPointerException - 如果 mechanismType 或 provider 為 null
NoSuchMechanismException - 如果從指定的提供者不能使用指定機制的 KeyInfoFactory 實作Providerpublic static KeyInfoFactory getInstance()
KeyInfoFactory。
此方法使用標準的 JCA 提供者尋找機制來尋找並實例化預設機制型別的 KeyInfoFactory 實作。它將從首選的 Provider 開始,遍歷已註冊的安全 Provider 的列表。返回取自第一個支持 DOM 機制的 Provider 中的新 KeyInfoFactory 物件。
注意,已註冊提供者的列表可以通過 Security.getProviders() 方法獲得。
KeyInfoFactory
NoSuchMechanismException - 如果沒有任何 Provider 支持 DOM 機制的 KeyInfoFactory 實作Providerpublic final String getMechanismType()
KeyInfoFactory 支持的 XML 處理機制型別和表示形式型別(比如:“DOM”)。
KeyInfoFactory 支持的 XML 處理機制型別public final Provider getProvider()
KeyInfoFactory 的提供者。
KeyInfoFactory 的提供者public abstract KeyInfo newKeyInfo(List content)
KeyInfo。
content - 一個列表,由一個或多個表示密鑰資訊型別的 XMLStructure 組成。需要複製該列表,以防止隨後被修改。
KeyInfo
NullPointerException - 如果 content 為 null
IllegalArgumentException - 如果 content 為空
ClassCastException - 如果 content 套件含任何不是型別 XMLStructure 的條目
public abstract KeyInfo newKeyInfo(List content,
String id)
KeyInfo。id 參數表示 XML ID 屬性值,對於從其他 XML 結構參考 KeyInfo 很有用。
content - 一個列表,由一個或多個表示密鑰資訊型別的 XMLStructure 組成。需要複製該列表,以防止隨後被修改。id - XML ID 的值(可以為 null)
KeyInfo
NullPointerException - 如果 content 為 null
IllegalArgumentException - 如果 content 為空
ClassCastException - 如果 content 套件含任何不是型別 XMLStructure 的條目public abstract KeyName newKeyName(String name)
KeyName。
name - 標識密鑰的名稱
KeyName
NullPointerException - 如果 name 為 null
public abstract KeyValue newKeyValue(PublicKey key)
throws KeyException
KeyValue。
key - 公鑰
KeyValue
KeyException - 如果 key 的演算法不可識別或不受 KeyInfoFactory 的支持
NullPointerException - 如果 key 為 nullpublic abstract PGPData newPGPData(byte[] keyId)
PGPData。
keyId - RFC 2440 第 11.2 節定義的 PGP 公鑰標識符。複製該陣列,以防止隨後被修改。
PGPData
NullPointerException - 如果 keyId 為 null
IllegalArgumentException - 如果密鑰 id 的格式不正確
public abstract PGPData newPGPData(byte[] keyId,
byte[] keyPacket,
List other)
PGPData。
keyId - RFC 2440 第 11.2 節定義的 PGP 公鑰標識符。複製該陣列,以防止隨後被修改。keyPacket - RFC 2440 第 5.5 節定義的 PGP 密鑰材料套件。複製該陣列,以防止隨後被修改。可以為 null。other - 一個列表,由表示外部名稱空間中的元素的 XMLStructure 組成。需要複製該列表,以防止隨後被修改。可以為 null 或空。
PGPData
NullPointerException - 如果 keyId 為 null
IllegalArgumentException - 如果 keyId 或 keyPacket 的格式不正確。對於 keyPacket,將檢查包頭的格式,並驗證標記,確定它屬於哪種型別的密鑰材料。包正文的內容和格式無需檢查。
ClassCastException - 如果 other 套件含任何不是型別 XMLStructure 的條目
public abstract PGPData newPGPData(byte[] keyPacket,
List other)
PGPData。
keyPacket - RFC 2440 第 5.5 節定義的 PGP 密鑰材料套件。複製該陣列,以防止隨後被修改。other - 一個列表,由表示外部名稱空間中的元素的 XMLStructure 組成。需要複製該列表,以防止隨後被修改。可以為 null 或空。
PGPData
NullPointerException - 如果 keyPacket 為 null
IllegalArgumentException - 如果 keyPacket 的格式不正確。對於 keyPacket,將檢查包頭的格式,並驗證標記,確定它屬於哪種型別的密鑰材料。包正文的內容和格式無需檢查。
ClassCastException - 如果 other 套件含任何不是型別 XMLStructure 的條目public abstract RetrievalMethod newRetrievalMethod(String uri)
RetrievalMethod。
uri - 標識將要檢索的 KeyInfo 資訊的 URI
RetrievalMethod
NullPointerException - 如果 uri 為 null
IllegalArgumentException - 如果 uri 與 RFC 2396 不相容
public abstract RetrievalMethod newRetrievalMethod(String uri,
String type,
List transforms)
RetrievalMethod。
uri - 標識將要檢索的 KeyInfo 資訊的 URItype - 標識將要檢索的 KeyInfo 資訊的型別的 URI (可以為 null)transforms - Transform 的列表。需要複製該列表,以防止隨後被修改。可以為 null 或空。
RetrievalMethod
NullPointerException - 如果 uri 為 null
IllegalArgumentException - 如果 uri 與 RFC 2396 不相容
ClassCastException - 如果 transforms 套件含不是型別 Transform 的任何條目public abstract X509Data newX509Data(List content)
X509Data。
content - 一個列表,由一個或多個 X.509 內容型別組成。有效的型別有 String(主體名稱)、byte[](主體的密鑰 id)、X509Certificate、X509CRL 或 XMLStructure(來自外部名稱空間的 X509IssuerSerial 物件或元素)。主體名稱是 RFC 2253 String 格式的標識名。這些實作必須支持 RFC 2253(CN、L、ST、O、OU、C、STREET、DC 和 UID)中定義的屬性型別關鍵字。這些實作可能還支持其他關鍵字。需要複製該列表,以防止隨後被修改。
X509Data
NullPointerException - 如果 content 為 null
IllegalArgumentException - 如果 content 為空,或者主體與 RFC 2253 不相容或無法識別其中一個屬性型別關鍵字。
ClassCastException - 如果 content 套件含不是上述任何有效型別的任何條目
public abstract X509IssuerSerial newX509IssuerSerial(String issuerName,
BigInteger serialNumber)
X509IssuerSerial。
issuerName - RFC 2253 String 格式的發佈方標識名。這些實作必須支持 RFC 2253(CN、L、ST、O、OU、C、STREET、DC 和 UID)中定義的屬性型別關鍵字。這些實作可能還支持其他關鍵字。serialNumber - 序列號
X509IssuerSerial
NullPointerException - 如果 issuerName 或 serialNumber 為 null
IllegalArgumentException - 如果發佈方名稱與 RFC 2253 不相容,或者無法識別其中一個屬性型別關鍵字。public abstract boolean isFeatureSupported(String feature)
feature - 功能名稱(以抽象 URI 形式)
true,否則返回 false
NullPointerException - 如果 feature 為 nullpublic abstract URIDereferencer getURIDereferencer()
URIDereferencer 的參考,預設情況下用於取消參考 RetrievalMethod 物件中的 URI。
URIDereferencer 的參考
public abstract KeyInfo unmarshalKeyInfo(XMLStructure xmlStructure)
throws MarshalException
XMLStructure(比如:DOMStructure)實例解組新的 KeyInfo 實例。
xmlStructure - 從中解組 keyinfo 的特定於機制的 XML 結構
KeyInfo
NullPointerException - 如果 xmlStructure 為 null
ClassCastException - 如果 xmlStructure 的型別不適合此處理器
MarshalException - 如果解組過程中發生不可恢復的異常
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。