私はXADES-BESとスマートカードを使ってXML文書に署名しようとしています。 私の必要に応じてSignerBES.javaクラスにいくつか変更を加えました。署名の作成はうまくいっています!UnsignedPropertiesを追加するにはどうすればよいですか?
私の質問:
<SignerRole>
<ClaimedRoles>
<ClaimedRole>EST</ClaimedRole>
</ClaimedRoles>
</SignerRole>
</SignedSignatureProperties>
<SignedDataObjectProperties>
<DataObjectFormat ObjectReference="#sigId">
<Description>des</Description>
<MimeType>text/xml</MimeType>
<Encoding>base64</Encoding>
</DataObjectFormat>
<CommitmentTypeIndication>
<CommitmentTypeId>
<Identifier/>
</CommitmentTypeId>
<AllSignedDataObjects/>
<CommitmentTypeQualifiers>
<CommitmentTypeQualifier>commitment</CommitmentTypeQualifier>
</CommitmentTypeQualifiers>
</CommitmentTypeIndication>
</SignedDataObjectProperties>
</SignedProperties>
<UnsignedProperties>
<UnsignedSignatureProperties>
<SignatureTimeStamp>
<EncapsulatedTimeStamp>noTimStampToken</EncapsulatedTimeStamp>
</SignatureTimeStamp>
<CounterSignature/>
<CompleteCertificateRefs/>
<CompleteRevocationRefs/>
<SigAndRefsTimeStamp/>
<RefsOnlyTimeStamp/>
<CertificatesValues/>
<RevocationValues/>
<ArchiveTimeStamp/>
</UnsignedSignatureProperties>
</UnsignedProperties>
</QualifyingProperties>
</ds:Object>
これはコードスニペットSignerBES.javaです:
Collection<SignedSignatureProperty> fsssp = new ArrayList<SignedSignatureProperty>(2);
Collection<UnsignedSignatureProperty> fsusp = new ArrayList<UnsignedSignatureProperty>(2);
getFormatSpecificSignatureProperties(fsssp, fsusp, signingCertificateChain);
// Gather all the signature and data objects properties.
QualifyingProperties qualifProps = qualifPropsProcessor.getQualifyingProperties(
signedDataObjects, fsssp, fsusp);
// LOG
System.out.println("fsusp"+fsusp.size());
私が追加しようとしましたどのように私はこのような何かを得るためにUnsignedPropertiesを追加することができますそれはSignerBES.javaとDefaultSignaturePropertiesProvider.javaにありますが、私はそれをどのように追加できるのか分かりません:
public class DefaultSignaturePropertiesProvider implements SignaturePropertiesProvider
{
@Override
public void provideProperties(SignaturePropertiesCollector signaturePropsCol)
{
signaturePropsCol.setSigningTime(new SigningTimeProperty());
signaturePropsCol.setSignerRole(new SignerRoleProperty("EST"));
// UnsignedProperty
// OtherUnsignedSignatureProperty otherUnsignedProp=null;
// signaturePropsCol.addOtherSignatureProperty(otherUnsignedProp);
}}
ありがとうございます。私はスマートカードでサインする初心者です。次のようなものを追加することもできます:signaturePropsCol.addOtherSignatureProperty(otherUnsignedProp) 追加するUnsignedPropertiesがいくつかあり、それらが進められています(私にはわかりません)?ブロックを手動で追加すると、署名チェックが無効になりますか? 。 –
私が応答で言ったように、xades4jを使用すると、リストのように追加することはありません。対応する署名プロファイルを使用すると、特定のフォームの署名されていない署名プロパティが自動的に追加されます。その他の署名されていないプロパティは、カスタムSignaturePropertiesProvider – lgoncalves