/** * Copyright 2006 by Know-Center, Graz, Austria * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a * joint initiative of the Federal Chancellery Austria and Graz University of * Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * This product combines work with different licenses. See the "NOTICE" text * file for details on the various modules and licenses. * The "NOTICE" text file is part of the distribution. Any derivative works * that you distribute must include a readable copy of the "NOTICE" text file. */ package at.gv.egiz.pdfas.impl.api.sign; import java.security.cert.X509Certificate; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; import at.gv.egiz.pdfas.api.io.DataSource; import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; import at.gv.egiz.pdfas.framework.input.TextDataSource; import at.gv.egiz.pdfas.framework.signator.SignatorInformation; import at.gv.egiz.pdfas.impl.api.commons.DataSourceApiAdapter; import at.gv.egiz.pdfas.impl.api.commons.TextBasedDataSourceApiAdapter; import at.knowcenter.wag.egov.egiz.pdf.EGIZDate; import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject; /** * * @author exthex * */ public class SignatureDetailInformationImpl implements SignatureDetailInformation { private DataSource signatureData; private SignaturePosition signaturePosition; private List nonTextualObjects; private String dateString; private Date signDate; private String issuer; private Map issuerDNMap; private String name; private String serialNumber; private String sigAlgorithm; private String sigID; private String sigKZ; private String signatureValue; private String sigTimeStamp; private Map subjectDNMap; private X509Certificate x509Certificate; private boolean textual; private Properties responseProperties; private SignatorInformation signatorInfo; public DataSource getSignatureData() { return this.signatureData; } public SignaturePosition getSignaturePosition() { return this.signaturePosition; } public List getNonTextualObjects() { return this.nonTextualObjects; } public Date getSignDate() { return this.signDate; } public String getIssuer() { return this.issuer; } public Map getIssuerDNMap() { return this.issuerDNMap; } public String getSubjectName() { return this.name; } public String getSerialNumber() { return this.serialNumber; } public String getSigAlgorithm() { return this.sigAlgorithm; } public String getSigID() { return this.sigID; } public String getSigKZ() { return this.sigKZ; } public String getSignatureValue() { return this.signatureValue; } public String getSigTimeStamp() { return this.sigTimeStamp; } public Map getSubjectDNMap() { return this.subjectDNMap; } public X509Certificate getX509Certificate() { return this.x509Certificate; } public boolean isTextual() { return textual; } public boolean isBinary() { return !textual; } public void setSignSignatureObject(SignSignatureObject sso) { this.dateString = sso.getDate(); if (this.dateString != null){ this.signDate = EGIZDate.parseDateFromString(this.dateString); } this.issuer = sso.getIssuer(); this.issuerDNMap = sso.getIssuerDNMap(); this.name = sso.getName(); //extracted from x509Certificate this.serialNumber = sso.getSerialNumber(); //extracted from x509Certificate this.sigAlgorithm = sso.getSigAlgorithm(); this.sigID = sso.getSigID(); this.sigKZ = sso.getSigKZ(); this.signatureValue = sso.getSignatureValue(); this.sigTimeStamp = sso.getSigTimeStamp(); this.subjectDNMap = sso.getSubjectDNMap(); this.x509Certificate = sso.getX509Certificate(); this.responseProperties = sso.response_properties; if (this.signatorInfo != null){ this.signatorInfo.setSignSignatureObject(sso); } } public SignSignatureObject getSignSignatureObject() { SignSignatureObject ret = new SignSignatureObject(); ret.date = this.dateString; ret.id = this.sigID; ret.issuer = this.issuer; ret.issuerDNMap = this.issuerDNMap; ret.kz = this.sigKZ; ret.response_properties = this.responseProperties; ret.sigAlgorithm = this.sigAlgorithm; ret.signatureValue = this.signatureValue; ret.sigTimeStamp = this.sigTimeStamp; ret.subjectDNMap = this.subjectDNMap; ret.x509Certificate = this.x509Certificate; return ret; } public SignatorInformation getSignatorInfo() { return this.signatorInfo; } public void setSignatorInformation(SignatorInformation signatorInformation){ this.signatorInfo = signatorInformation; this.signaturePosition = new ActualSignaturePositionAdapter(signatorInformation.getActualTablePos()); this.nonTextualObjects = signatorInformation.getNonTextualObjects(); at.gv.egiz.pdfas.framework.input.DataSource dataSource = signatorInformation.getSignatureData().getDataSource(); if (dataSource instanceof TextDataSource) this.signatureData = new TextBasedDataSourceApiAdapter((TextDataSource)dataSource); else this.signatureData = new DataSourceApiAdapter(dataSource); } }