モジュール 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"/>
            <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>
     
    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
    関連項目:
    KeyInfoFactory.newKeyValue(PublicKey)
    • フィールドの詳細

      • 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構造を記述できます。
        関連項目:
        定数フィールド値
    • メソッドの詳細

      • getPublicKey

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