374.8. 서명자 끝점용 XAdES-BES/EPES
Camel 2.15.0부터 사용 가능
XML Advanced Electronic Signatures(XAdES) 는 XML 서명에 대한 확장을 정의합니다. 이 표준은 유럽 통신 표준위원회 ( European Telecommunication Standards Institute )에 의해 정의되었으며 전자 서명을 위해 커뮤니티 프레임 워크에서 유럽 연합 지침 (1999/93/EC)을 준수하는 서명을 만들 수 있습니다. XAdES는 서명 양식이라고 하는 다양한 서명 속성 세트를 정의합니다. 서명자 엔드 포인트에 대한 서명 양식 기본 전자 서명 (XAdES-BES) 및 Explicit Policy Based Electronic Signature (XAdES-EPES)를 지원합니다. 유효성 검사 데이터를 사용한 전자 서명 XAdES-T 및 XAdES-C 양식은 지원되지 않습니다.
XAdES-EPES 양식의 다음 속성을 지원합니다("?"는 0개 또는 1개의 발생을 나타냅니다).
지원되는 XAdES-EPES 속성
<QualifyingProperties Target>
<SignedProperties>
<SignedSignatureProperties>
(SigningTime)?
(SigningCertificate)?
(SignaturePolicyIdentifier)
(SignatureProductionPlace)?
(SignerRole)?
</SignedSignatureProperties>
<SignedDataObjectProperties>
(DataObjectFormat)?
(CommitmentTypeIndication)?
</SignedDataObjectProperties>
</SignedProperties>
</QualifyingProperties>
XAdES-BES 형식의 속성은 SignaturePolicyIdentifier 속성이 XAdES-BES의 일부가 아닌 점을 제외하면 동일합니다.
8080 org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties 또는 org.camel.component.xmlsecurity.api.DefaultXAdESSignatureProperties를 통해 XAdES-BES/EPES 속성을 구성할 수 있습니다. XAdESSignatureProperties 는 SigningCertificate 속성을 제외한 위에 언급된 모든 속성을 지원합니다. SigningCertificate 속성을 가져오려면 XAdESSignatureProperties.getSigningCertificate() 또는 XAdESSignatureProperties.getSigningCertificate Cryostat() 메서드를 덮어써야 합니다. DefaultXAdESSignatureProperties 클래스는 getSigningCertificate() 메서드를 덮어쓰고 키 저장소 및 별칭을 통해 서명 인증서를 지정할 수 있습니다. 다음 예제에서는 지정할 수 있는 모든 매개변수를 보여줍니다. 특정 매개변수가 필요하지 않은 경우 생략할 수 있습니다.
Java DSL의 XAdES-BES/EPES 예
Keystore keystore = ... // load a keystore
DefaultKeyAccessor accessor = new DefaultKeyAccessor();
accessor.setKeyStore(keystore);
accessor.setPassword("password");
accessor.setAlias("cert_alias"); // signer key alias
DefaultXAdESSignatureProperties props = new DefaultXAdESSignatureProperties();
props.setNamespace("http://uri.etsi.org/01903/v1.3.2#"); // sets the namespace for the XAdES elements; the namspace is related to the XAdES version, default value is "http://uri.etsi.org/01903/v1.3.2#", other possible values are "http://uri.etsi.org/01903/v1.1.1#" and "http://uri.etsi.org/01903/v1.2.2#"
props.setPrefix("etsi"); // sets the prefix for the XAdES elements, default value is "etsi"
// signing certificate
props.setKeystore(keystore));
props.setAlias("cert_alias"); // specify the alias of the signing certificate in the keystore = signer key alias
props.setDigestAlgorithmForSigningCertificate(DigestMethod.SHA256); // possible values for the algorithm are "http://www.w3.org/2000/09/xmldsig#sha1", "http://www.w3.org/2001/04/xmlenc#sha256", "http://www.w3.org/2001/04/xmldsig-more#sha384", "http://www.w3.org/2001/04/xmlenc#sha512", default value is "http://www.w3.org/2001/04/xmlenc#sha256"
props.setSigningCertificateURIs(Collections.singletonList("http://certuri"));
// signing time
props.setAddSigningTime(true);
// policy
props.setSignaturePolicy(XAdESSignatureProperties.SIG_POLICY_EXPLICIT_ID);
// also the values XAdESSignatureProperties.SIG_POLICY_NONE ("None"), and XAdESSignatureProperties.SIG_POLICY_IMPLIED ("Implied")are possible, default value is XAdESSignatureProperties.SIG_POLICY_EXPLICIT_ID ("ExplicitId")
// For "None" and "Implied" you must not specify any further policy parameters
props.setSigPolicyId("urn:oid:1.2.840.113549.1.9.16.6.1");
props.setSigPolicyIdQualifier("OIDAsURN"); //allowed values are empty string, "OIDAsURI", "OIDAsURN"; default value is empty string
props.setSigPolicyIdDescription("invoice version 3.1");
props.setSignaturePolicyDigestAlgorithm(DigestMethod.SHA256);// possible values for the algorithm are "http://www.w3.org/2000/09/xmldsig#sha1", http://www.w3.org/2001/04/xmlenc#sha256", "http://www.w3.org/2001/04/xmldsig-more#sha384", "http://www.w3.org/2001/04/xmlenc#sha512", default value is http://www.w3.org/2001/04/xmlenc#sha256"
props.setSignaturePolicyDigestValue("Ohixl6upD6av8N7pEvDABhEL6hM=");
// you can add qualifiers for the signature policy either by specifying text or an XML fragment with the root element "SigPolicyQualifier"
props.setSigPolicyQualifiers(Arrays
.asList(new String[] {
"<SigPolicyQualifier xmlns=\"http://uri.etsi.org/01903/v1.3.2#\"><SPURI>http://test.com/sig.policy.pdf</SPURI><SPUserNotice><ExplicitText>display text</ExplicitText>"
+ "</SPUserNotice></SigPolicyQualifier>", "category B" }));
props.setSigPolicyIdDocumentationReferences(Arrays.asList(new String[] {"http://test.com/policy.doc.ref1.txt",
"http://test.com/policy.doc.ref2.txt" }));
// production place
props.setSignatureProductionPlaceCity("Munich");
props.setSignatureProductionPlaceCountryName("Germany");
props.setSignatureProductionPlacePostalCode("80331");
props.setSignatureProductionPlaceStateOrProvince("Bavaria");
//role
// you can add claimed roles either by specifying text or an XML fragment with the root element "ClaimedRole"
props.setSignerClaimedRoles(Arrays.asList(new String[] {"test",
"<a:ClaimedRole xmlns:a=\"http://uri.etsi.org/01903/v1.3.2#\"><TestRole>TestRole</TestRole></a:ClaimedRole>" }));
props.setSignerCertifiedRoles(Collections.singletonList(new XAdESEncapsulatedPKIData("Ahixl6upD6av8N7pEvDABhEL6hM=",
"http://uri.etsi.org/01903/v1.2.2#DER", "IdCertifiedRole")));
// data object format
props.setDataObjectFormatDescription("invoice");
props.setDataObjectFormatMimeType("text/xml");
props.setDataObjectFormatIdentifier("urn:oid:1.2.840.113549.1.9.16.6.2");
props.setDataObjectFormatIdentifierQualifier("OIDAsURN"); //allowed values are empty string, "OIDAsURI", "OIDAsURN"; default value is empty string
props.setDataObjectFormatIdentifierDescription("identifier desc");
props.setDataObjectFormatIdentifierDocumentationReferences(Arrays.asList(new String[] {
"http://test.com/dataobject.format.doc.ref1.txt", "http://test.com/dataobject.format.doc.ref2.txt" }));
//commitment
props.setCommitmentTypeId("urn:oid:1.2.840.113549.1.9.16.6.4");
props.setCommitmentTypeIdQualifier("OIDAsURN"); //allowed values are empty string, "OIDAsURI", "OIDAsURN"; default value is empty string
props.setCommitmentTypeIdDescription("description for commitment type ID");
props.setCommitmentTypeIdDocumentationReferences(Arrays.asList(new String[] {"http://test.com/commitment.ref1.txt",
"http://test.com/commitment.ref2.txt" }));
// you can specify a commitment type qualifier either by simple text or an XML fragment with root element "CommitmentTypeQualifier"
props.setCommitmentTypeQualifiers(Arrays.asList(new String[] {"commitment qualifier",
"<c:CommitmentTypeQualifier xmlns:c=\"http://uri.etsi.org/01903/v1.3.2#\"><C>c</C></c:CommitmentTypeQualifier>" }));
beanRegistry.bind("xmlSignatureProperties",props);
beanRegistry.bind("keyAccessorDefault",keyAccessor);
// you must reference the properties bean in the "xmlsecurity" URI
from("direct:xades").to("xmlsecurity:sign://xades?keyAccessor=#keyAccessorDefault&properties=#xmlSignatureProperties")
.to("mock:result");
XAdES-BES/EPES in Spring XML
...
<from uri="direct:xades" />
<to
uri="xmlsecurity:sign://xades?keyAccessor=#accessorRsa&properties=#xadesProperties" />
<to uri="mock:result" />
...
<bean id="xadesProperties"
class="org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties">
<!-- For more properties see the previous Java DSL example.
If you want to have a signing certificate then use the bean class DefaultXAdESSignatureProperties (see the previous Java DSL example). -->
<property name="signaturePolicy" value="ExplicitId" />
<property name="sigPolicyId" value="http://www.test.com/policy.pdf" />
<property name="sigPolicyIdDescription" value="factura" />
<property name="signaturePolicyDigestAlgorithm" value="http://www.w3.org/2000/09/xmldsig#sha1" />
<property name="signaturePolicyDigestValue" value="Ohixl6upD6av8N7pEvDABhEL1hM=" />
<property name="signerClaimedRoles" ref="signerClaimedRoles_XMLSigner" />
<property name="dataObjectFormatDescription" value="Factura electrónica" />
<property name="dataObjectFormatMimeType" value="text/xml" />
</bean>
<bean class="java.util.ArrayList" id="signerClaimedRoles_XMLSigner">
<constructor-arg>
<list>
<value>Emisor</value>
<value><ClaimedRole
xmlns="http://uri.etsi.org/01903/v1.3.2#"><test
xmlns="http://test.com/">test</test></ClaimedRole></value>
</list>
</constructor-arg>
</bean>
374.8.1. headers 링크 복사링크가 클립보드에 복사되었습니다!
| 헤더 | 유형 | 설명 |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| XAdES 네임스페이스 매개변수 값 덮어쓰기 |
|
|
| XAdES 접두사 매개변수 값을 덮어씁니다. |
374.8.2. XAdES 버전 1.4.2에 대한 제한 사항 링크 복사링크가 클립보드에 복사되었습니다!
- 서명 양식 XAdES-T 및 XAdES-C에 대한 지원 없음
- 서명자만 구현됩니다. Verifier 부분은 현재 제공되지 않습니다.
-
QualifyingPropertiesReference요소는 지원되지 않습니다(spec의 6.3.2 섹션 참조). -
SignaturePolicy
Identifier 요소에 포함된지원 없음SignaturePolicyId요소에 포함된Transforms요소 -
unsignedProperties 요소
→ 서명되지 않은Properties요소를 지원하지 않음 -
최대 하나의
DataObjectFormat요소입니다. 서명 된 데이터 개체가 하나만 있기 때문에 두 개 이상의DataObjectFormat요소는 의미가 없습니다 (이는 XML 서명자 엔드포인트에 들어오는 메시지 본문임). -
CommitmentTypeIndication요소입니다. 서명된 데이터 오브젝트가 하나만 있기 때문에 두 개 이상의CommitmentTypeIndication요소는 의미가 없습니다(이는 XML 서명자 엔드포인트에 들어오는 메시지 본문임). -
CommitmentTypeIndication요소에는 항상AllSignedDataObjects요소가 포함됩니다.CommitmentTypeIndication요소 내의ObjectReference요소는 지원되지 않습니다. -
AllDataObjectsTimeStamp요소는 지원되지 않습니다. -
individualDataObjectsTimeStamp요소는 지원되지 않습니다.