224 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
compact3
</div>
<div class="subTitle">
javax.xml.crypto.dsig.keyinfo
</div>
<h2 class="title" title="Interface KeyValue">Interface KeyValue</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>
All Superinterfaces:
</dt>
<dd>
<span><a href="../../../../../javax/xml/crypto/XMLStructure.html" title="javax.xml.crypto中的接口">XMLStructure</a></span>
</dd>
</dl>
<hr/> <br/> <pre>public interface <span class="typeNameLabel">KeyValue</span>
extends <a href="../../../../../javax/xml/crypto/XMLStructure.html" title="interface in javax.xml.crypto">XMLStructure</a></pre>
<div class="block">
<span>W3C Recommendation for XML-Signature Syntax and Processing中定义的XML <code>KeyValue</code>元素的<a href="http://www.w3.org/TR/xmldsig-core/">表示</a></span>
<span><code>KeyValue</code>对象包含一个单一的公钥,可用于验证签名。</span>
<span>XML模式定义定义为</span>
<pre> <span>&lt;element name="KeyValue" type="ds:KeyValueType"/&gt;
&lt;complexType name="KeyValueType" mixed="true"&gt;
&lt;choice&gt;
&lt;element ref="ds:DSAKeyValue"/&gt;
&lt;element ref="ds:RSAKeyValue"/&gt;
&lt;any namespace="##other" processContents="lax"/&gt;
&lt;/choice&gt;
&lt;/complexType&gt;
&lt;element name="DSAKeyValue" type="ds:DSAKeyValueType"/&gt;
&lt;complexType name="DSAKeyValueType"&gt;
&lt;sequence&gt;
&lt;sequence minOccurs="0"&gt;
&lt;element name="P" type="ds:CryptoBinary"/&gt;
&lt;element name="Q" type="ds:CryptoBinary"/&gt;
&lt;/sequence&gt;
&lt;element name="G" type="ds:CryptoBinary" minOccurs="0"/&gt;
&lt;element name="Y" type="ds:CryptoBinary"/&gt;
&lt;element name="J" type="ds:CryptoBinary" minOccurs="0"/&gt;
&lt;sequence minOccurs="0"&gt;
&lt;element name="Seed" type="ds:CryptoBinary"/&gt;
&lt;element name="PgenCounter" type="ds:CryptoBinary"/&gt;
&lt;/sequence&gt;
&lt;/sequence&gt;
&lt;/complexType&gt;
&lt;element name="RSAKeyValue" type="ds:RSAKeyValueType"/&gt;
&lt;complexType name="RSAKeyValueType"&gt;
&lt;sequence&gt;
&lt;element name="Modulus" type="ds:CryptoBinary"/&gt;
&lt;element name="Exponent" type="ds:CryptoBinary"/&gt;
&lt;/sequence&gt;
&lt;/complexType&gt;</span> </pre>
<span>可以通过调用<a href="../../../../../javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.html" title="javax.xml.crypto.dsig.keyinfo中的类"><code>KeyInfoFactory</code></a>类的<a href="../../../../../javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.html#newKeyValue-java.security.PublicKey-"><code>newKeyValue</code></a>方法创建一个<code>KeyValue</code>实例,并传递一个<a href="../../../../../java/security/PublicKey.html" title="java.security中的接口">表示</a>公钥值的<code>PublicKey</code></span>
<span>以下是一个<code>KeyValue</code><a href="../../../../../java/security/interfaces/DSAPublicKey.html" title="java.security.interfaces中的接口"><code>DSAPublicKey</code></a>创建的<a href="../../../../../java/security/cert/Certificate.html" title="java.security.cert中的类"><code>Certificate</code></a>存储在<a href="../../../../../java/security/KeyStore.html" title="java.security中的类"><code>KeyStore</code></a>中的<a href="../../../../../java/security/KeyStore.html" title="java.security中的类">示例</a> </span>
<pre> <span>KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
PublicKey dsaPublicKey = keyStore.getCertificate("myDSASigningCert").getPublicKey();
KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
KeyValue keyValue = factory.newKeyValue(dsaPublicKey);</span> </pre>
<span>此类返回的<code>DSAKeyValue</code><code>RSAKeyValue</code>元素类型的对象<a href="../../../../../java/security/interfaces/DSAPublicKey.html" title="java.security.interfaces中的接口"><code>DSAPublicKey</code></a><a href="../../../../../java/security/interfaces/RSAPublicKey.html" title="java.security.interfaces中的接口"><code>RSAPublicKey</code></a> ,分别。</span>
<span>请注意,并非模式中的所有字段都可以作为这些类型的参数访问。</span>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.6
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../../../javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.html#newKeyValue-java.security.PublicKey-"><code>KeyInfoFactory.newKeyValue(PublicKey)</code></a>
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- --> </a> <h3>Field Summary</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Field Summary table, listing fields, and an explanation">
<caption>
<span>Fields</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/xml/crypto/dsig/keyinfo/KeyValue.html#DSA_TYPE">DSA_TYPE</a></span></code>
<div class="block">
标识DSA KeyValue KeyInfo类型的URIhttp://www.w3.org/2000/09/xmldsig#DSAKeyValue。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../java/lang/String.html" title="class in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/xml/crypto/dsig/keyinfo/KeyValue.html#RSA_TYPE">RSA_TYPE</a></span></code>
<div class="block">
标识RSA KeyValue KeyInfo类型的URIhttp://www.w3.org/2000/09/xmldsig#RSAKeyValue。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t2"><span><a href="javascript:show(2);">接口方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t3"><span><a href="javascript:show(4);">抽象方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code><a href="../../../../../java/security/PublicKey.html" title="interface in java.security">PublicKey</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/xml/crypto/dsig/keyinfo/KeyValue.html#getPublicKey--">getPublicKey</a></span>()</code>
<div class="block">
返回此
<code>KeyValue</code>
</div> </td>
</tr>
</tbody>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.javax.xml.crypto.XMLStructure">
<!-- --> </a> <h3>Methods inherited from interface javax.xml.crypto.<a href="../../../../../javax/xml/crypto/XMLStructure.html" title="interface in javax.xml.crypto">XMLStructure</a></h3> <code><a href="../../../../../javax/xml/crypto/XMLStructure.html#isFeatureSupported-java.lang.String-">isFeatureSupported</a></code></li>
</ul> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- --> </a> <h3>字段详细信息</h3> <a name="DSA_TYPE">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>DSA_TYPE</h4> <pre>static final <a href="../../../../../java/lang/String.html" title="class in java.lang">String</a> DSA_TYPE</pre>
<div class="block">
<span>标识DSA KeyValue KeyInfo类型的URIhttp://www.w3.org/2000/09/xmldsig#DSAKeyValue。</span>
<span>这可以指定为<a href="../../../../../javax/xml/crypto/dsig/keyinfo/RetrievalMethod.html" title="javax.xml.crypto.dsig.keyinfo中的接口"><code>RetrievalMethod</code></a>类的<code>type</code>参数的值来描述远程<code>DSAKeyValue</code>结构。</span>
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../../../constant-values.html#javax.xml.crypto.dsig.keyinfo.KeyValue.DSA_TYPE">Constant Field Values</a>
</dd>
</dl> </li>
</ul> <a name="RSA_TYPE">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>RSA_TYPE</h4> <pre>static final <a href="../../../../../java/lang/String.html" title="class in java.lang">String</a> RSA_TYPE</pre>
<div class="block">
<span>标识RSA KeyValue KeyInfo类型的URIhttp://www.w3.org/2000/09/xmldsig#RSAKeyValue。</span>
<span>这可以指定为<code>type</code>参数的<a href="../../../../../javax/xml/crypto/dsig/keyinfo/RetrievalMethod.html" title="javax.xml.crypto.dsig.keyinfo中的接口"><code>RetrievalMethod</code></a>类来描述远程<code>RSAKeyValue</code>结构的值。</span>
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../../../constant-values.html#javax.xml.crypto.dsig.keyinfo.KeyValue.RSA_TYPE">Constant Field Values</a>
</dd>
</dl> </li>
</ul> </li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="getPublicKey--">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>getPublicKey</h4> <pre><a href="../../../../../java/security/PublicKey.html" title="interface in java.security">PublicKey</a> getPublicKey()
throws <a href="../../../../../java/security/KeyException.html" title="class in java.security">KeyException</a></pre>
<div class="block">
返回此
<code>KeyValue</code>
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
这个公钥的这个
<code>KeyValue</code>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../../../java/security/KeyException.html" title="class in java.security">KeyException</a></code> - 如果这
<code>KeyValue</code>不能转换为
<code>PublicKey</code>
</dd>
</dl> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>