xades4j와 대응 된 문서에 나타났습니다. 카운터 서명 된 서명의 참조에 Type = ".. CountersignedSignature"가 없습니다. document.signed.bes.cs.xml의 xades4j 단위 테스트에서도 마찬가지입니다.xades4j의 카운터 싱된 서명 유형이 누락되었습니다.
public String COUNTER_SIGNATURE_TYPE_URI = "http://uri.etsi.org/01903#CountersignedSignature";
가 어떻게 그 속성을 사용하기에 XAdES을 강제 할 수 있습니다 : 한편
,xades4j.properties.CounterSignatureProperty
에 나는 정의 다음과 같은 속성을 볼 수 있습니까? type 속성이 없으면 다른 타사 소프트웨어에서 문서 유효성 검사에 문제가 있습니다.
SignerBESTest에 작성된 코드를 사용했습니다.
Document doc = getTestDocument();
Element elemToSign = doc.getDocumentElement();
XadesBesSigningProfile profile = new XadesBesSigningProfile(keyingProviderMy);
final XadesSigner counterSigner = profile.newSigner();
profile.withSignaturePropertiesProvider(new SignaturePropertiesProvider() {
@Override
public void provideProperties(final SignaturePropertiesCollector signedPropsCol) {
signedPropsCol.addCounterSignature(new CounterSignatureProperty(counterSigner));
signedPropsCol.setSignerRole(new SignerRoleProperty("CounterSignature"));
}
});
final XadesSignatureFormatExtender extender = new XadesFormatExtenderProfile().getFormatExtender();
final List<UnsignedSignatureProperty> unsignedProps = new ArrayList<UnsignedSignatureProperty>();
unsignedProps.add(new CounterSignatureProperty(counterSigner));
org.apache.xml.security.Init.init();
final Element sigElem = (Element) documentSource.getElementsByTagName("ds:Signature").item(0);
final XMLSignature xmlSig = new XMLSignature(sigElem, documentSource.getBaseURI());
extender.enrichSignature(xmlSig, new UnsignedProperties(unsignedProps));
미리 감사드립니다.
EDIT1가 : 나는 소스를 xades4j 수정하여 내가 해결책을 알고 추가 할 것입니다하지만 난 단지 내 소스 코드에서 적용 할 수있는 솔루션에 더 관심이있을 것입니다.
xades4j를 변경하는 것보다 src/main/java/xades4j/production/DataGenCounterSig.java를 수정하여 추가 할 수 있습니다 :'sigValueRef = sigValueRef.withType (CounterSignatureProperty.COUNTER_SIGNATURE_TYPE_URI);'(http : // www. speedyshare.com/Cgc2j/DataGenCounterSig.java). 어쨌든 그것을해야했지만 하드 코딩되어 있습니다. 반면에이 애트리뷰트는 선택 사항이므로 add 타입은 항상 어떤 것도 깨뜨려서는 안된다. –
예, 그게 전부입니다. 속성은 중복되므로 필요하지 않지만 문제가되지 않아야합니다. xades4j 소스를 업데이트하겠습니다. – lgoncalves