374장. XML 보안 구성 요소

Camel 버전 2.12로 사용 가능

이 Apache Camel 구성 요소를 사용하면 W3C 표준 XML 서명 Syntax 및 Processing 또는 후속 버전 1.1 에 설명된 대로 XML 서명 을 생성하고 검증할 수 있습니다. XML 암호화 지원은 XML 보안 데이터 형식 을 참조하십시오.

XML 서명에 대한 소개는 여기에서 찾을 수 있습니다. 구성 요소 구현은 W3C 표준에 해당하는 Java API인 JSR 105 를 기반으로 하며, JSR 105의 Apache Santuario 및 JDK 공급자를 지원합니다. 구현은 먼저 Apache Santuario 공급자를 사용하려고 합니다. Santuario 공급자를 찾지 못하면 JDK 공급자를 사용합니다. 또한, 구현은 DOM 기반입니다.

Camel 2.15.0에서는 서명자 끝점에 대한 XAdES-BES/EPES 지원도 제공합니다. "XAdES-BES/EPES" 섹션을 참조하십시오.

Maven 사용자는 이 구성 요소를 위해 다음 종속성을 pom.xml 에 추가해야 합니다.

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-xmlsecurity</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

374.1. XML 서명 조치 모드

XML 서명은 봉투, enveloping 및 분리된 XML 서명 간에 다릅니다. 봉투 된 XML 서명 경우 XML 서명은 서명된 XML 문서에 의해 래핑됩니다. 즉 XML 서명 요소는 서명된 XML 문서에 속하는 부모 요소의 자식 요소임을 의미합니다. enveloping XML 서명 사례에서 XML 서명에는 서명된 콘텐츠가 포함되어 있습니다. 다른 모든 경우는 분리된 XML 서명이라고 합니다. 2.14.0 년부터 특정 형식의 분리된 XML 서명이 지원됩니다.

봉투 XML 서명의 경우 지원되는 생성된 XML 서명 에는 다음과 같은 구조가 있습니다(Variables는 []로 둘러싸여 있음).

<[parent element]>
   ... <!-- Signature element is added as last child of the parent element-->
   <Signature Id="generated_unique_signature_id">
       <SignedInfo>
             <Reference URI="">
                   <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
                   (<Transform>)* <!-- By default "http://www.w3.org/2006/12/xml-c14n11" is added to the transforms -->
                   <DigestMethod>
                   <DigestValue>
             </Reference>
             (<Reference URI="#[keyinfo_Id]">
                   <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
                   <DigestMethod>
                   <DigestValue>
             </Reference>)?
             <!-- further references possible, see option 'properties' below -->
      </SignedInfo>
      <SignatureValue>
      (<KeyInfo Id="[keyinfo_id]">)?
      <!-- Object elements possible, see option 'properties' below -->
  </Signature>
</[parent element]>

enveloping XML 서명 사례에서 지원되는 생성된 XML 서명은 다음과 같은 구조를 갖습니다.

<Signature Id="generated_unique_signature_id">
  <SignedInfo>
         <Reference URI="#generated_unique_object_id" type="[optional_type_value]">
               (<Transform>)* <!-- By default "http://www.w3.org/2006/12/xml-c14n11" is added to the transforms -->
               <DigestMethod>
               <DigestValue>
         </Reference>
         (<Reference URI="#[keyinfo_id]">
               <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
               <DigestMethod>
               <DigestValue>
         </Reference>)?
          <!-- further references possible, see option 'properties' below  -->
  </SignedInfo>
  <SignatureValue>
  (<KeyInfo Id="[keyinfo_id]">)?
  <Object Id="generated_unique_object_id"/> <!-- The Object element contains the in-message body; the object ID can either be generated or set by the option parameter "contentObjectId" -->
  <!-- Further Object elements possible, see option 'properties' below -->
</Signature>

2.14.0 분리 XML 서명 이 지원됩니다(지정된 요소의 Siblings로 하위 서명 참조).

(<[signed element] Id="[id_value]">
<!-- signed element must have an attribute of type ID -->
      ...

</[signed element]>
<other sibling/>* 
<!-- between the signed element and the corresponding signature element, there can be other siblings.
 Signature element is added as last sibling. -->
<Signature Id="generated_unique_ID">
   <SignedInfo>
      <CanonicalizationMethod>
      <SignatureMethod>
      <Reference URI="#[id_value]" type="[optional_type_value]">
      <!-- reference URI contains the ID attribute value of the signed element -->
            (<Transform>)* <!-- By default "http://www.w3.org/2006/12/xml-c14n11" is added to the transforms -->
            <DigestMethod>
            <DigestValue>
      </Reference>
      (<Reference URI="#[generated_keyinfo_Id]">
            <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
            <DigestMethod>
            <DigestValue>
      </Reference>)?
   </SignedInfo>
   <SignatureValue>
   (<KeyInfo Id="[generated_keyinfo_id]">)?
</Signature>)+