373.8. 署名者エンドポイントの XAdES-BES/EPES
Camel 2.15.0 以降で利用可能
XML Advanced Electronic Signatures (XAdES) は、XML 署名の拡張機能を定義します。この標準は、European Telecommunication Standards Institute によって定義されたもので、電子署名のコミュニティーフレームワークに関する EU 指令 (1999/93/EC) に準拠した署名を作成できます。XAdES は、署名フォームと呼ばれるさまざまな署名プロパティーのセットを定義します。署名者エンドポイントの署名形式として、基本的な電子署名 (XAdES-BES) と 明示的なポリシーベースの電子署名 (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 の一部ではないことを除いて同じです。
bean org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties から XAdES-BES/EPES を設定できます、または org.apache.camel.component.xmlsecurity.api.DefaultXAdESSignatureProperties.XAdESSignatureProperties から SigningCertificate プロパティーを除く上述のすべてのプロパティーをサポートします。SigningCertificate プロパティーを取得するには、メソッド XAdESSignatureProperties.getSigningCertificate() または XAdESSignatureProperties.getSigningCertificateChain() を上書きする必要があります。 クラス 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");Spring XML での XAdES-BES/EPES の例
...
<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>373.8.1. ヘッダー
| ヘッダー | タイプ | 説明 |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| XAdES 名前空間パラメーター値を上書きします。 |
|
|
| XAdES 接頭辞 パラメーター値を上書きします。 |
373.8.2. XAdES バージョン 1.4.2 に関する制限事項
- 署名フォーム XAdES-T および XAdES-C はサポートされていません。
- signer 部分のみ実装されています。Verifier パーツは現在利用できません。
-
QualifyingPropertiesReference要素はサポートされていません (仕様のセクション 6.3.2 を参照)。 -
SignaturePolicyIdentifier elementに含まれるSignaturePolicyId要素を含有するTransforms要素はサポートされていません。 -
CounterSignature要素はサポートされていません →UnsignedProperties要素はサポートされていません。 -
最大 1 つの
DataObjectFormat要素。署名されたデータオブジェクトは 1 つしかないため (これは、XML signer エンドポイントへの受信メッセージボディーです)、複数のDataObjectFormat要素は意味がありません。 -
最大で 1 つの
CommitmentTypeIndication要素。署名されたデータオブジェクトは 1 つしかないため、複数のCommitmentTypeIndication要素は意味がありません (これは、XML 署名者エンドポイントへの入力メッセージボディーです)。 -
CommitmentTypeIndication要素には、常にAllSignedDataObjects要素が含まれます。CommitmentTypeIndication要素内のObjectReference要素はサポートされていません。 -
AllDataObjectsTimeStamp要素はサポートされていません -
IndividualDataObjectsTimeStamp要素はサポートされていません