モジュール java.xml.crypto

インタフェースKeyValue

すべてのスーパー・インタフェース:
XMLStructure

public interface KeyValue extends XMLStructure
W3C Recommendation for XML-Signature Syntax and Processing」で定義されているXML KeyValue要素の表現。 KeyValueオブジェクトには、署名の検証に便利な単一の公開キーが格納されます。 XMLスキーマ定義は、次のように定義されます。
    <element name="KeyValue" type="ds:KeyValueType"/>
    <complexType name="KeyValueType" mixed="true">
      <choice>
        <element ref="ds:DSAKeyValue"/>
        <element ref="ds:RSAKeyValue"/>
        <!-- <element ref="dsig11:ECKeyValue"/> -->
        <!-- ECC keys (XMLDsig 1.1) will use the any element -->
        <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>

    <complexType name="ECKeyValueType">
      <sequence>
        <choice>
          <element name="ECParameters" type="dsig11:ECParametersType" />
          <element name="NamedCurve" type="dsig11:NamedCurveType" />
        </choice>
        <element name="PublicKey" type="dsig11:ECPointType" />
      </sequence>
      <attribute name="Id" type="ID" use="optional" />
    </complexType>

    <complexType name="NamedCurveType">
      <attribute name="URI" type="anyURI" use="required" />
    </complexType>

    <simpleType name="ECPointType">
      <restriction base="ds:CryptoBinary" />
    </simpleType>
 
ECParametersTypeの定義については、W3C推奨の4.5.2.3.1の項を参照してください。

KeyValueインスタンスは、KeyInfoFactoryクラスのnewKeyValueメソッドを呼び出し、公開キーの値を表現するPublicKeyを渡すことによって作成されます。 次に、KeyStore内に格納されるCertificateDSAPublicKeyから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要素を返します。 スキーマ内のすべてのフィールドが、これらの型のパラメータとしてアクセス可能であるわけではありません。

導入されたバージョン:
1.6
関連項目:
  • フィールドのサマリー

    フィールド
    修飾子と型
    フィールド
    説明
    static final String
    DSA KeyValue KeyInfo型を識別するURI: http://www.w3.org/2000/09/xmldsig#DSAKeyValueです。
    static final String
    EC KeyValue KeyInfoタイプを識別するURI : http://www.w3.org/2009/xmldsig11#ECKeyValue.
    static final String
    RSA KeyValue KeyInfo型を識別するURI: http://www.w3.org/2000/09/xmldsig#RSAKeyValueです。
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    このKeyValueの公開キーを返します。

    インタフェース javax.xml.crypto.XMLStructureで宣言されたメソッド

    isFeatureSupported
  • フィールド詳細

    • DSA_TYPE

      static final String DSA_TYPE
      DSA KeyValue KeyInfo型を識別するURI: http://www.w3.org/2000/09/xmldsig#DSAKeyValueです。 これは、RetrievalMethodクラスのtypeパラメータの値として指定して、リモートのDSAKeyValue構造を記述できます。
      関連項目:
    • RSA_TYPE

      static final String RSA_TYPE
      RSA KeyValue KeyInfo型を識別するURI: http://www.w3.org/2000/09/xmldsig#RSAKeyValueです。 これは、RetrievalMethodクラスのtypeパラメータの値として指定して、リモートのRSAKeyValue構造を記述できます。
      関連項目:
    • EC_TYPE

      static final String EC_TYPE
      EC KeyValue KeyInfoタイプを識別するURI : http://www.w3.org/2009/xmldsig11#ECKeyValue. これは、リモートのECKeyValue構造を記述するRetrievalMethodクラスのtypeパラメータの値として指定できます。
      関連項目:
  • メソッドの詳細

    • getPublicKey

      PublicKey getPublicKey() throws KeyException
      このKeyValueの公開キーを返します。
      戻り値:
      このKeyValueの公開キー
      例外:
      KeyException - このKeyValuePublicKeyに変換できない場合