|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
public interface KeyValue
W3C Recommendation for XML-Signature Syntax and Processing 中定義的 XML KeyValue 元素的表示形式。KeyValue 物件包含一個在驗證簽章時很有用的公鑰。XML Schema Definition 的定義如下:
<element name="KeyValue" type="ds:KeyValueType"/>
<complexType name="KeyValueType" mixed="true">
<choice>
<element ref="ds:DSAKeyValue"/>
<element ref="ds:RSAKeyValue"/>
<any namespace="##other" processContents="lax"/>
</choice>
</complexType>
<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
<complexType name="DSAKeyValueType">
<sequence>
<sequence minOccurs="0">
<element name="P" type="ds:CryptoBinary"/>
<element name="Q" type="ds:CryptoBinary"/>
</sequence>
<element name="G" type="ds:CryptoBinary" minOccurs="0"/>
<element name="Y" type="ds:CryptoBinary"/>
<element name="J" type="ds:CryptoBinary" minOccurs="0"/>
<sequence minOccurs="0">
<element name="Seed" type="ds:CryptoBinary"/>
<element name="PgenCounter" type="ds:CryptoBinary"/>
</sequence>
</sequence>
</complexType>
<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
<complexType name="RSAKeyValueType">
<sequence>
<element name="Modulus" type="ds:CryptoBinary"/>
<element name="Exponent" type="ds:CryptoBinary"/>
</sequence>
</complexType>
通過調用 KeyInfoFactory 類別的 newKeyValue 方法,並向其傳遞表示公鑰值的 PublicKey,可以創建 KeyValue 實例。下面是一個範例,該範例根據 KeyStore 中存儲的 Certificate 的 DSAPublicKey 創建了一個 KeyValue:
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
PublicKey dsaPublicKey = keyStore.getCertificate("myDSASigningCert").getPublicKey();
KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
KeyValue keyValue = factory.newKeyValue(dsaPublicKey);
此類別將分別以型別 DSAPublicKey 和 RSAPublicKey 物件的形式返回 DSAKeyValue 和 RSAKeyValue 元素。注意,並非網要中的所有欄位都可以作為這些型別的參數進行存取。
KeyInfoFactory.newKeyValue(PublicKey)| 欄位摘要 | |
|---|---|
static String |
DSA_TYPE
標識 DSA KeyValue KeyInfo 型別的 URI:http://www.w3.org/2000/09/xmldsig#DSAKeyValue。 |
static String |
RSA_TYPE
標識 RSA KeyValue KeyInfo 型別的 URI:http://www.w3.org/2000/09/xmldsig#RSAKeyValue。 |
| 方法摘要 | |
|---|---|
PublicKey |
getPublicKey()
返回此 KeyValue 的公鑰。 |
| 從介面 javax.xml.crypto.XMLStructure 繼承的方法 |
|---|
isFeatureSupported |
| 欄位詳細資訊 |
|---|
static final String DSA_TYPE
RetrievalMethod 類別的 type 參數值,以描述遠端 DSAKeyValue 結構。
static final String RSA_TYPE
RetrievalMethod 類別的 type 參數值,以描述遠端 RSAKeyValue 結構。
| 方法詳細資訊 |
|---|
PublicKey getPublicKey()
throws KeyException
KeyValue 的公鑰。
KeyValue 的公鑰
KeyException - 如果無法將此 KeyValue 轉換為 PublicKey
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。