aboutsummaryrefslogtreecommitdiff
path: root/signature-standards
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-14 11:37:09 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-14 11:37:09 +0200
commit9e4d7a91c3e6c7cece30bf9956e2360dbf4c312b (patch)
treec338c4e326c08c60db492484ba8ef9708367e78c /signature-standards
parent87cd5e8be869b19e6b37dbb13056882efff976a0 (diff)
downloadpdf-as-4-9e4d7a91c3e6c7cece30bf9956e2360dbf4c312b.tar.gz
pdf-as-4-9e4d7a91c3e6c7cece30bf9956e2360dbf4c312b.tar.bz2
pdf-as-4-9e4d7a91c3e6c7cece30bf9956e2360dbf4c312b.zip
Log Levels changed
Diffstat (limited to 'signature-standards')
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java1
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java32
-rw-r--r--signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java2
-rw-r--r--signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java3
4 files changed, 31 insertions, 7 deletions
diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java
index 16a56c90..f0eedb61 100644
--- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java
+++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java
@@ -135,6 +135,7 @@ public class PAdESSignerKeystore implements IPlainSigner {
public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException {
try {
+ logger.info("Creating PAdES signature.");
IssuerAndSerialNumber issuer = new IssuerAndSerialNumber(cert);
AlgorithmID[] algorithms = CertificateUtils.getAlgorithmIDs(cert);
diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java
index e39db2c6..91754317 100644
--- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java
+++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java
@@ -50,6 +50,7 @@ import at.gv.egiz.moa.SignatureVerificationServiceStub.VerifyCMSSignatureRespons
import at.gv.egiz.moa.SignatureVerificationServiceStub.VerifyCMSSignatureResponseTypeSequence;
import at.gv.egiz.moa.SignatureVerificationServiceStub.X509DataTypeSequence;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.common.messages.CodesResolver;
import at.gv.egiz.pdfas.common.utils.PDFUtils;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
import at.gv.egiz.pdfas.lib.api.Configuration;
@@ -112,13 +113,17 @@ public class PAdESVerifier implements IVerifyFilter {
VerifyCMSSignatureResponse response = service
.verifyCMSSignature(verifyCMSSignatureRequest);
+ logger.debug("Got Verify Response from MOA");
+
VerifyCMSSignatureResponseTypeSequence[] verifySequence = response
.getVerifyCMSSignatureResponse()
.getVerifyCMSSignatureResponseTypeSequence();
for (int i = 0; i < verifySequence.length; i++) {
VerifyResultImpl result = new VerifyResultImpl();
-
- SignatureCheck certificateCheck;
+ logger.debug(" ---------------------- ");
+ logger.debug("Signature: " + i);
+
+ SignatureCheckImpl certificateCheck;
verifySequence[i].getSignerInfo().getKeyInfoTypeChoice()[0]
.getExtraElement();
@@ -132,16 +137,32 @@ public class PAdESVerifier implements IVerifyFilter {
} else {
certificateCheck = new SignatureCheckImpl(
1,
- "Es konnte keine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konstruiert werden.");
+ "");
}
- SignatureCheck signatureCheck = new SignatureCheckImpl(
+ if(certificateCheck.getMessage() == null || certificateCheck.getMessage().trim().length() == 0) {
+ String resourceString = "verify.cert." + certificateCheck.getCode();
+ String message = CodesResolver.resolveMessage(resourceString);
+ certificateCheck.setMessage(message);
+ }
+
+ logger.debug("Certificate Check: " + certificateCheck.getCode() + " [" + certificateCheck.getMessage() + "]");
+
+ SignatureCheckImpl signatureCheck = new SignatureCheckImpl(
verifySequence[i].getSignatureCheck().getCode()
.intValue(),
verifySequence[i].getSignatureCheck().isInfoSpecified() ? verifySequence[i]
.getSignatureCheck().getInfo().toString()
: "");
+ if(signatureCheck.getMessage() == null || signatureCheck.getMessage().trim().length() == 0) {
+ String resourceString = "verify.value." + signatureCheck.getCode();
+ String message = CodesResolver.resolveMessage(resourceString);
+ signatureCheck.setMessage(message);
+ }
+
+ logger.debug("Signature Check: " + signatureCheck.getCode() + " [" + signatureCheck.getMessage() + "]");
+
result.setCertificateCheck(certificateCheck);
result.setValueCheckCode(signatureCheck);
result.setVerificationDone(true);
@@ -211,8 +232,11 @@ public class PAdESVerifier implements IVerifyFilter {
}
resultList.add(result);
+
+ logger.debug(" ---------------------- ");
}
} catch (Throwable e) {
+ logger.error("Verification failed", e);
throw new PdfAsException("error.pdf.verify.02", e);
}
return resultList;
diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java
index 7b45a45a..62839ea6 100644
--- a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java
+++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java
@@ -104,7 +104,7 @@ public class PKCS7DetachedSigner implements IPlainSigner {
while ((dataIs.read(buf)) > 0)
; // skip data
ContentInfo ci = new ContentInfo(si);
- logger.info("PKCS7 signature done.");
+ logger.debug("PKCS7 signature done.");
return ci.getEncoded();
} catch (NoSuchAlgorithmException e) {
throw new PdfAsSignatureException("error.pdf.sig.01", e);
diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java
index 605142a6..bef034b1 100644
--- a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java
+++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java
@@ -129,8 +129,7 @@ public class PKCS7DetachedVerifier implements IVerifyFilter {
}
public void setConfiguration(Configuration config) {
- // TODO Auto-generated method stub
-
+ // not needed
}
}