aboutsummaryrefslogtreecommitdiff
path: root/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-12 12:46:38 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-12 12:46:38 +0100
commit40fc290721a9ab0c7a815dc60ea965d615860f21 (patch)
treec5e3e19f17f5af292dc870c887079e154182a741 /signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs
parent9bc71794a49d89e1ff6adab76f5f473b94b3d348 (diff)
downloadpdf-as-4-40fc290721a9ab0c7a815dc60ea965d615860f21.tar.gz
pdf-as-4-40fc290721a9ab0c7a815dc60ea965d615860f21.tar.bz2
pdf-as-4-40fc290721a9ab0c7a815dc60ea965d615860f21.zip
Moved hard coded error strings into common.propreties
Diffstat (limited to 'signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs')
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java13
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java3
2 files changed, 8 insertions, 8 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 5ae0ed76..89293fa1 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
@@ -53,7 +53,7 @@ public class PAdESSignerKeystore implements IPlainSigner {
privKey = (PrivateKey) ks.getKey(alias, keypassword.toCharArray());
cert = new X509Certificate(ks.getCertificate(alias).getEncoded());
} catch (Throwable e) {
- throw new PdfAsException("Failed to get KeyStore", e);
+ throw new PdfAsException("error.pdf.sig.02", e);
}
}
@@ -124,6 +124,7 @@ public class PAdESSignerKeystore implements IPlainSigner {
si.addSignerInfo(signer1);
InputStream dataIs = si.getInputStream();
byte[] buf = new byte[1024];
+ @SuppressWarnings("unused")
int r;
while ((r = dataIs.read(buf)) > 0)
; // skip data
@@ -131,15 +132,15 @@ public class PAdESSignerKeystore implements IPlainSigner {
return ci.getEncoded();
} catch (NoSuchAlgorithmException e) {
- throw new PdfAsSignatureException("Failed to generate Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.01", e);
} catch (iaik.cms.CMSException e) {
- throw new PdfAsSignatureException("Failed to generate Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.01", e);
} catch (IOException e) {
- throw new PdfAsSignatureException("Failed to generate Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.01", e);
} catch (CertificateException e) {
- throw new PdfAsSignatureException("Failed to generate Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.01", e);
} catch (CodingException e) {
- throw new PdfAsSignatureException("Failed to generate Signature", e);
+ throw new PdfAsSignatureException("error.pdf.sig.01", e);
}
}
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 6e79a1a0..52a58d56 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
@@ -1,6 +1,5 @@
package at.gv.egiz.pdfas.sigs.pades;
-import iaik.security.provider.IAIK;
import iaik.x509.X509Certificate;
import java.util.ArrayList;
@@ -174,7 +173,7 @@ public class PAdESVerifier implements IVerifyFilter {
resultList.add(result);
}
} catch (Throwable e) {
- e.printStackTrace();
+ throw new PdfAsException("error.pdf.verify.02", e);
}
return resultList;
}